2

I've been cached response from instagram api.but response contains specular time format, that i didn't meet it anywhere.

"created_time":"1437648595",

and now my Question is:

How to convert it from this template (As String type) to System.DateTime type? tanx

Meghdad
  • 23
  • 7

2 Answers2

3

Instagram uses this value as a Unix time, you can get this as a double first and you can use it as ;

DateTime dt = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
dt = dt.AddSeconds(1437648595).ToLocalTime();

It returns 23.07.2015 13:49:55 in my time zone which I currently in UTC+03:00.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
1

I think this post answers your question. How to convert a Unix timestamp to DateTime and vice versa?

The format that you have posted looks like Unix time. Start your searching from there ;)

Community
  • 1
  • 1