Skip to content Skip to sidebar Skip to footer

Parsing Javascript Date

A website I am looking at has the following code. var d = new Date(1362236400000); This javascript date object somehow encodes the following HTML output, '2/3/2013 10:00' Coul

Solution 1:

The value is the number of miliseconds since the epoch. In Python that could be handled with the datetime.datetime.fromtimestamp() constructor:

>>> import datetime
>>> datetime.datetime.fromtimestamp(1362236400000/1000)
datetime.datetime(2013, 3, 2, 16, 0)

Post a Comment for "Parsing Javascript Date"