Jump to content

Substitute For Php Function?


pizzaguy

Recommended Posts

Is there any way to achieve the same results gained by using mktime in php, using Javascript? Im trying to make a countdown timer, but i would like to have it check the time over and over instead of a method like subtracting 1 every second.

Link to comment
Share on other sites

The Javascript date object does that. https://developer.mozilla.org/En/Core_JavaS...al_Objects:DateOnce you have a date object, you can use date.valueOf to get the Unix timestamp like you get with PHP, but keep in mind that the timestamps in Javascript are in milliseconds, the ones in PHP are in seconds. To get the same timestamp you would get from time or mktime in PHP, you need to divide by 1000 in Javascript.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...