cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Using a time picker with below code . The Server side of SAP is in EDM.string format as PT13H31M00S .

How is the value to be converted from time picker to required format.


  <DateTimeInput
  type="Time"

id="datepicker"

  placeholder="Enter Time ..."
  class="sapUiSmallMarginBottom" />


controller,js

var dtime = this.getView().byId('datepicker').getValue();

alert(dtime); //1:31 PM


Are there any functions to achieve the same ?



0 Likes
View Entire Topic
santhu_gowdaz
Active Contributor
0 Likes
  • var oInsptmTxt = new sap.m.Text({ 
  •   text: { 
  •     path: "Time"
  •    formatter: function(value) { 
  • return value.match(/(\d{2})H(\d{2})M(\d{2})S$/).slice(-3).join(":"); 
  •     } 
  •   } 
  • });

Refer these links,

EDM.Time is not converting in SAPUI5 | SCN

Former Member
0 Likes

Can you suggest how to achieve similar in XML format ? My code is added above.

santhu_gowdaz
Active Contributor
0 Likes

<Text text="{path: "Time", formatter:'Util.FormatterTime' }"/>

 

  In your util formatter write this code,

 

  FormatterTime:function(value)

  {

return value.match(/(\d{2})H(\d{2})M(\d{2})S$/).slice(-3).join(":");

}