Javascript Objects: More Date Methods - The GetTime() Method
(Page 4 of 5 )
If you were insane and wanted to know how many milliseconds there have been since January 1, 1970, you could use this method. I'm sure there are things you can do with it; I myself just like to ogle it in amazement:
<html>
<body>
<script type="text/javascript">
var stupid = new Date()
document.write("There have been a total of ")
document.write(stupid.getTime() + " milliseconds since January 1st, 1970 <br />")
document.write("Someone figured out the code for <i>that</i> <br />")
document.write("But still no cure for cancer...")
</script>
</body>
</html>
Which prints out:
There have been a total of 1194028473421 milliseconds since January 1st, 1970
Someone figured out the code for that
But still no cure for cancer...
The GetTimeZoneOffset() Method
Again, I can't really imagine why you would use this particular method, but I am sure that some people will find a use for it. It returns the time difference between the local time and the Greenwich Mean Time (GMT).
<html>
<body>
<script type="text/javascript">
var useless = new Date()
document.write(useless.getTimezoneOffset())
</script>
</body>
</html>
This returns: 240. Though it may be different, depending on which time zone you live in.
Next: The GetUTDate, Month, FullYear() Methods >>
More JavaScript Articles
More By James Payne