Parsing a date returned as JSON in .net?

Hi, I received responses from the API as JSON and downloaded it into my application. All imports a fine, except for the date on which a particular item was posted. The date is returned as a number I never worked with:

'date_created' : 1279643054

I tried using regular DateTime.Parse () with no luck. Does anyone know how to parse this, or, if you like, what is the name of this format, can I continue to research? Thank.

+3
source share
1 answer

This is a UNIX timestamp . Use this code to convert a timestamp into an object DateTime:

static DateTime ConvertFromUnixTimestamp(long timestamp)
{
    return new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(timestamp);
}
+3
source

All Articles