Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get a human readable date from a unix timestamp in Javascript?

In my javascript, I have a unix timestamp (in this instance `1318305600000") and I need to convert that into a human readable date via Javascript.

How do I go about doing this?

like image 547
KallDrexx Avatar asked Oct 19 '11 20:10

KallDrexx


People also ask

How do I turn a timestamp into a date?

You can simply use the fromtimestamp function from the DateTime module to get a date from a UNIX timestamp. This function takes the timestamp as input and returns the corresponding DateTime object to timestamp.

How do you convert Epoch to human readable date?

Convert from epoch to human-readable datemyString := DateTimeToStr(UnixToDateTime(Epoch)); Where Epoch is a signed integer. Replace 1526357743 with epoch. =(A1 / 86400) + 25569 Format the result cell for date/time, the result will be in GMT time (A1 is the cell with the epoch number).

How do I read a Unix timestamp?

To find the unix current timestamp use the %s option in the date command. The %s option calculates unix timestamp by finding the number of seconds between the current date and unix epoch.


1 Answers

alert(new Date(1318305600000))
like image 152
SLaks Avatar answered Sep 30 '22 19:09

SLaks