cancel
Showing results for 
Search instead for 
Did you mean: 

JSON Date Format

Former Member
0 Kudos

Hi,

We have a Gateway service with some date fields (ABAP datatype DATS converted to Edm.DateTime or Edm.DateTimeOffset).

When service is called with output format JSON, date values are represented in MicrosoftDateFormat format (e.g. "/Date(1448841600000)/").

In contrary, when output format is XML, dates are in ISO-8601 format: YYYY-MM-DDThh:mm:ssTZD (e.g. 1997-07-16T19:20:30+01:00).

Is there any way to change the JSON date format, either in field level or system level?

Accepted Solutions (1)

Accepted Solutions (1)

AshwinDutt
Active Contributor
0 Kudos

Hello Shai,

Current formats which you are getting are the standard ones.

If at all you want to send back the Date value in some other format, then you will have to use Edm.String in GW level and send back the date value with the desired format from DPC.

Regards,

Ashwn

Former Member
0 Kudos

I was afarid of it.

Thanks, anyway.

Answers (2)

Answers (2)

vinita_kasliwal
Active Contributor
0 Kudos

Hi Shai

The way we did was to do an ABAP coding and then based on the date being recieved using Fm to convert the date to the dd/mm/yyyy format by using concatenate statement and passing to a new variable and then sending it to UI layer

Regards

Vinita

0 Kudos

Hi Shai,

Unfortunately those are the standard ones for XML(ISO-8601) and JSON (Epoch) respectively.

If you want to change the output at system level for JSON, use an EDM.String to represent the formated datetime you want. For UI which will use the Epoch datetime, there are several libraries that convert Epoch to human readable time. Our UI devs prefer the latter but it depends on your requirement.

Regards,

Francis

Former Member
0 Kudos

For the matter of fact, we don't have a real problem with Epoch format. The main issue is with MicrosoftDateFormat format (the hybrid "/Date(Epoch)/").

It will require our service consumers to develop a special (very simple) parser