davej Posted March 31, 2012 Share Posted March 31, 2012 <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 More sharing options...
Ingolme Posted March 31, 2012 Share Posted March 31, 2012 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 More sharing options...
thescientist Posted March 31, 2012 Share Posted March 31, 2012 (edited) edit: as Ingolme said Edited March 31, 2012 by thescientist Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now