Create a unix timestamp

I want to have a countdown to unix timestamp: Where does it count in seconds

Like this:

Expires in: 1d 10h 52m 25s

Here is an example timestamp: 1303725600

How can i do this?

+4
source share
2 answers

I just made one of them. http://chrischerry.name/coachella

Check out the source for some ideas on how to do this. However, the “appointment date” is not indicated by the unix timestamp, but it is easy enough to do.

var date = new Date(unix_timestamp*1000); 

Its multiplied by 1000, because javascript Date () wants time in milliseconds, and unixtimestamps want seconds.

+2
source

I think this will work ...

 $tDiff = 1303725600 - time(); $days = floor($tDiff / 86400); $hours = ($tDiff / 3600) % 24; $mins = ($tDiff / 60) % 60; $secs = ($tDiff) % 60; 
+3
source

All Articles