2

does anyone know what type of date format is it, and how can I parse it properly to Date object? I get it from server in a Jason response.

{ "DateFirstListed":"\/Date(1438218663000+1000)\/" }
Alireza Sobhani
  • 769
  • 1
  • 8
  • 18
  • see here for more info: http://stackoverflow.com/questions/10286204/the-right-json-date-format – Henry Oct 21 '15 at 04:53

1 Answers1

1

you can just use the part before the +1000

it's a standard unix time stamp with milliseconds. I'm not sure what the +1000 is for but likely it's just to offset the time by 1 second. (1000 ms)

so paste Date(1438218663000) in your browser console and you'll see

"Tue Oct 20 2015 21:27:39 GMT-0700 (Pacific Daylight Time)"

It could possibly be intended to be a Human Friendly url so that it can be stored in unix time, but you can use

/articles/Tue Oct 20 2015 21:27:39 GMT-0700 (Pacific Daylight Time) as a url. But in any case, it's just unix time.

EDIT: +1000 (thanks Sasha) probably means UTC+10:00, so you could create your date like this

new Date(new Date(1438218663000).getTime()+10*60*60*1000)

AwokeKnowing
  • 7,728
  • 9
  • 36
  • 47