How to convert Datastream datetime ?

LarryT
LarryT Contributor

I’m receiving date/timestamps in the format of
"\/Date(1415750400000+0000)\/" in the response. Can you please
explain how I can convert this to a regular date/time format?

Best Answer

  • Monika.Stankovic
    Answer ✓

    @LarryT

    In this date format \/Date(XXXXXX+XXXX)\/ we have two parts:

    1. “XXXXXX”
      part is the number of milliseconds since 1 January 1970
    2. “+XXXX” part indicates the time
      zone, so when you see “+0000”, it means the server time zone is UTC.

    We use the default Microsoft .NET JSON serialization engine
    which emits JSON date as the number of milliseconds elapsed since 01-01-1970
    UTC.

    A relevant documentation on this can be found from the MSDN site here under section “DateTime Wire Format”.

    You can also use XML transport if the JSON format is
    inconvenient for you. REST/XML returns dates in the format of
    “CCYY-MM-DDT00:00:00” – e.g. 2016-11-21T00:00:00.

Answers