Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Time formatting

Hi all,

i want format edm.time(PT08H30M37S) to normal time

i check this link

https://scn.sap.com/thread/3438087

and i tried using below code but its not working.

in view.xml

<Input enabled="false" value="{ path:'/ConstraintActivityStartTime', formatter:'order.format.Formatter.Time'    }" ></Input>


in  Formatter.js


Time : function (fValue) {
   var date =  new Date(fValue);
var timeinmiliseconds = date.getTime() ;
var timeFormat = sap.ui.core.format.DateFormat.getTimeInstance({pattern: "KK:mm:ss a"});
var TZOffsetMs = new Date(0).getTimezoneOffset()*60*1000;  
var timeStr = timeFormat.format(new Date(timeinmiliseconds + TZOffsetMs)); 

   return  timeStr ;

}

if you know what's wrong in that please share it.

Thanks & Regards,

Venkat

Not what you were looking for? View more on this topic or Ask a question