Home arrow JavaScript arrow Page 2 - JavaScript Date Objects: Universal Coordinated Time
JAVASCRIPT

JavaScript Date Objects: Universal Coordinated Time


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

Author Info:
By: James Payne
Rating: 5 stars5 stars5 stars5 stars5 stars / 3
February 22, 2008
TABLE OF CONTENTS:
  1. · JavaScript Date Objects: Universal Coordinated Time
  2. · The GetUTCHour, Minute, Second, and Milliseconds() Function
  3. · Introducing One of the Most Asinine Functions Ever
  4. · Using the UTC() Function

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
JavaScript Date Objects: Universal Coordinated Time - The GetUTCHour, Minute, Second, and Milliseconds() Function
(Page 2 of 4 )

The UTC in GetUTC stands for Universal Coordinated Time. The reason it's not UCT is a little complicated. Basically, when the system was devised in 1970, the International Telecommunication Union wanted a single abbreviation that would be used by all languages. The English speakers wanted Coordinated Universal Time (CUT) and the French speakers wanted Temps Universel Coordonné (TUC). Since they couldn't reach agreement, the ITU decided on UTC, to equally annoy both sides. And that's probably more than you really wanted to know. 

Anyway, that's the way it is. In our next example we will display the UTC hours, minutes, seconds and milliseconds:


<html>

<body>

<script type="text/javascript">

var duh = new Date();

document.write("The UTC Hour is ")

document.write(duh.getUTCHours());

document.write("<br />")

document.write("The UTC Minute is ")

document.write(duh.getUTCMinutes());

document.write("<br />")

document.write("The UTC Second is ")

document.write(duh.getUTCSeconds());

document.write("<br />")

document.write("The UTC Millisecond is ")

document.write(duh.getUTCMilliseconds());

</script>

</body>

</html>

The result of this brilliant code (please, hold the applause):

  The UTC Hour is 22
  The UTC Minute is 41
  The UTC Second is 55
  The UTC Millisecond is 734

The results of this code will, of course, appear differently when you run it, unless by some bizarre coincidence you happen to run it at the same exact time as I did, down to the milliseconds.


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