SAP Knowledge Base Article - Public

3513178 - Invalid Date conversion in JSON (EPOCH Conversion)

Symptom

The data for the Date field is valid in Successfactors instance but when querying the date field via ODATA API in JSON format, it is converting to an invalid date.


Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.

Environment

SAP SuccessFactors HXM Suite

  • Integration
    • ODATA API

Reproducing the Issue

Example the Date field value for the Date Of Birth field is "Tuesday, September 23, 1969 12:00:00 AM"

The System converts the date to EPOCH format for ODATA API response in JSON format to (-8640000000) in Milliseconds Format.

But when we convert this EPOCH format using any Online converter the date is resulting in  "Saturday, March 17, 1696 12:00:00 AM" which is invalid.

Cause

In Successfactors the Date conversion for JSON format is always in Milliseconds that is (-8640000000), but for most of the EPOCH converters the conversion works in Unix format and it converts the last 3 zero to a different date.

Due to this you get the date as "  Saturday, March 17, 1696 12:00:00 AM " instead of " Tuesday, September 23, 1969 12:00:00 AM "

Resolution

You will have to remove the last 3 zero i.e. (-8640000) instead of (-8640000000) for the EPOCH converters where you have last 3 digits as Zero and when you convert this EPOCH value it would result in the correct date i.e. Tuesday, September 23, 1969 12:00:00 AM.


PLEASE NOTE: This is only for those EPOCH values which have last 3 digits as zero, if you have last 3 digits as any other number you don't have to remove the last 3 digits.

Keywords

ODATA, API, LOD-SF-INT-API, LOD-SF-INT-ODATA, EPOCH Conversion issue, JSON Date format issue, JSON Date, Invalid Date, INVALID API response , KBA , LOD-SF-INT-ODATA , OData API Framework , LOD-SF-INT-API , API & Adhoc API Framework , LOD-SF-INT , Integrations , Problem

Product

SAP SuccessFactors HCM Core 2405 ; SAP SuccessFactors HCM Suite 2405