Skip to Content
2
Jan 02, 2017 at 02:56 PM

Create JSON with date in Unix Time format

1095 Views

I need to create a JSON document for a REST web service call. In this JSON there is a date field that needs to formatted in Unix Time (seconds since 1st of January 1970)

Request: [
{
"ID":"XYZ",
"Date":1475272800000
} ]

The data is coming from an ABAP Structure:
ID TYPE C(8),
DATE TYPE D

Is there a way to create such a JSON directly via e.g. CALL TRANSFORMATION or is there at least a method/function module to convert ABAP dates to UNIX Time?