Skip to Content

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

Format time value from odata records

Hi All,

I am facing one critical issue to convert time format which is coming from SAP Odata model. I am able to format the value with the below code if I give static value

var DepartureTime = {__edmType: "Edm.Time", ms: 39600000};

   var timeFormat = sap.ui.core.format.DateFormat.getTimeInstance({pattern: "kk:mm"});

   var TZOffsetMs = new Date(0).getTimezoneOffset()*60*1000;

   var timeStr = timeFormat.format(new Date( + TZOffsetMs));

   var parsedTime = new Date(timeFormat.parse(timeStr).getTime() - TZOffsetMs);

   console.log('Time = ' +timeStr);

I am unable to get that value from odata to convert into Time format. I am getting the value as [object Object]. Here is the screen shot of values I am getting from SAP Odata model. Can you please helo how we can retrieve the value from "DepartureTime"



Message was edited by: Michael Appleby (typos)

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