user1034912
user1034912

Reputation: 2267

What DateTime format is this called? "/Date(1565929330662)/"

I received this DateTime format from a WebAPI output. The back end is from Microsoft .NET WCF.

{
    "data": [
        {
            "Id": "Random.Real4",
            "TagName": "Random",
            "Parameter": "Real4",
            "LastValue": {
                "IsError": false,
                "TSUTC": "/Date(1565929330662)/",
                "Value": 12780.19,
                "AggMark": false
            }
        }
    ]
}

Is there a conventional name for such Date Time format?

Thanks

Upvotes: 0

Views: 276

Answers (4)

Saif
Saif

Reputation: 2689

Convert milliseconds date to date in C#

var date = (new DateTime(1970, 1, 1)).AddMilliseconds(double.Parse("1565929330662")).ToString("yyyy-mm-dd hh:mm:ss");

output 2019-22-16 04:22:10

Upvotes: 2

Chetan Naik
Chetan Naik

Reputation: 643

Its UNIX timestamp. This timestamp can be converted to date and time

Follow the link for more details, https://www.unixtimestamp.com/

Upvotes: 3

ebk
ebk

Reputation: 335

is this something related to your access token .Web api returns token expiration time in the above format called Epoch time (or Unix time).

Upvotes: 1

caladeve
caladeve

Reputation: 496

Looks like Epoch time (or Unix time) - the number of seconds that have elapsed since 00:00:00 Thursday, 1 January 1970. Paste the timestamp into a converter to see what it represents. You can use a library like moment.js to parse this and use it in your app.

Upvotes: 1

Related Questions