7

Possible Duplicate:
How do I output an ISO-8601 formatted string in Javascript?

If I have an integer that represents a date in milliseconds, what is the syntax to convert this to an iso format?

Community
  • 1
  • 1
Rolando
  • 51,528
  • 92
  • 250
  • 377

2 Answers2

13

Check out the Date object:

new Date(ms).toISOString()

Notice that this method might not be available in older browsers, but you can shim it for them.

Bergi
  • 572,313
  • 128
  • 898
  • 1,281
0
new Date(value);

from here, where value represent the milliseconds since 1970. And you could then call toISOString on yr date object.

NimChimpsky
  • 44,999
  • 57
  • 192
  • 304