Jump to content

Date.getTime()


davej

Recommended Posts

<script type="text/javascript">var d = new Date();var t = d.getTime();alert(t);t = d.getTime();alert(t);t = d.getTime();alert(t);</script>

So apparently getTime retrieves a constant value that is created when the Date object is instantiated, or is there some trick to this? http://www.w3schools.com/jsref/jsref_gettime.asp

Link to comment
Share on other sites

The date doesn't automatically update itself. The default value of a Date object is the moment it was created. Then you can set the hours, days, and other values later. Create a new date object each time you want the time updated.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...