0

I have a Odata service which brings back audit date and time in following pattern

AUDIT_Date : Sun Nov 23 -4713 16:07:02 GMT-0752 (Pacific Standard Time)

AUDIT_time: : ms:0 __edmType: "Edm.Time"

in metadata I see the format as :

<d:AUDIT_DATE m:type="Edm.DateTime">0000-00-00T00:00:00.0000000</d:AUDIT_DATE>

<d:AUDIT_TIME m:type="Edm.Time">PT0H0M0S</d:AUDIT_TIME>

I am trying to create a new record and while doing so I need to pass current date and time in those fields. I saw some blogs on date formats but none is giving me clear example on how I should solve this issue.

       The data object I am trying to pass to OdataModel.create is "parts"
       and need to pass 
       parts.Audit_date = "current date"
       parts.Audit_Time = "current time" in those formats. 
THI
  • 355
  • 11
  • 40

1 Answers1

0

for example:

parts.Audit_date = "/Date(1354665600000)/";
parts.Audit_Time = "PT11H00M00S";

the date is ms since 1970 and the time is 11 hours 0 minutes and 0 seconds : )

this is the best blog to find information about edm dates and times in my opinion: https://blogs.sap.com/2013/04/28/working-with-odata-dates/

Erch
  • 589
  • 5
  • 25