0

I get current time from http://nist.time.gov , it returns this value 1396677467961079 for today. but what type of value is that?

I tried this:

var dateTime = new DateTime();
dateTime.AddSeconds(val);  // val is of type double

But it throws an exception saying value was out of range. How can I convert that value?

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
user3293835
  • 829
  • 2
  • 15
  • 30

1 Answers1

0

It's Unix Time, commonly used in JavaScript / JSON.

Probably the best way to convert it is described into this response. In your case they are sending you the number of milliseconds since the Unix epoch so you have to divide it by 1000.

EDIT: fixed the link and added a bit more description

Community
  • 1
  • 1
Manuel Spezzani
  • 1,041
  • 7
  • 15
  • and the code sample is like this: `var dateTime = new DateTime(1970, 1, 1).AddMilliseconds(1396677467961079 / 1000d);` – Zafar Apr 05 '14 at 09:16