Skip to Content

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Apr 07, 2016 at 09:02 AM

    Hi ,

    Please check if this works for you

    text :  {
                                      path:"DATE",
                                      formatter : function(value){
                                          return  new Date(value).toString().substring(0, 15)
                                      }
    

    This is the output date format

    Thanks


    Add comment
    10|10000 characters needed characters exceeded