Home arrow JavaScript arrow Page 4 - Javascript Objects: More Date Methods
JAVASCRIPT

Javascript Objects: More Date Methods


We previously left off discussing a smattering of JavaScript Date Objects. In this tutorial we will continue the discussion, picking up with the GetFullYear() Method. There are a ton of Date methods, so let's get started.

Author Info:
By: James Payne
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
February 11, 2008
TABLE OF CONTENTS:
  1. · Javascript Objects: More Date Methods
  2. · The GetHours() Method
  3. · Putting the Three Together
  4. · The GetTime() Method
  5. · The GetUTDate, Month, FullYear() Methods

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
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.


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Tutorials for Beginners
- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 3 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials