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
  • 58,640
  • 98
  • 266
  • 407

2 Answers2

15

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
  • 630,263
  • 148
  • 957
  • 1,375
0
new Date(value);

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

NimChimpsky
  • 46,453
  • 60
  • 198
  • 311