Skip to Content
Former Member
Sep 16, 2014 at 01:54 PM

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)


odata_date1.png (20.1 kB)