JavaScript
  Home arrow JavaScript arrow Page 2 - JavaScript Date Objects: Universal Coordin...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

JavaScript Date Objects: Universal Coordinated Time
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2008-02-22

    Table of Contents:
  • JavaScript Date Objects: Universal Coordinated Time
  • The GetUTCHour, Minute, Second, and Milliseconds() Function
  • Introducing One of the Most Asinine Functions Ever
  • Using the UTC() Function

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    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.

    More JavaScript Articles
    More By James Payne


       · Thanks for dropping by to check out my article discussing more of the Javascript...
     

    JAVASCRIPT ARTICLES

    - Detect Browser Compatibility with the Reques...
    - Using the EXT JS Date Picker Widget
    - Ajax Hack for Entering Information Without R...
    - EXT JS 2.1 Overview
    - Using the Style Object for Zebra Tables with...
    - Binary Searching
    - An Improved Approach to Building Zebra Tables
    - Assigning Background Colors Dynamically to Z...
    - Building Zebra Tables with CSS and JavaScript
    - JavaScript: Array Objects
    - A Closer Look at Smart Markers with Yahoo! M...
    - Using Polylines and Smart Markers with Yahoo...
    - Bulleted Menu of Links
    - Creating Click Loggers and Basic Markers wit...
    - Adding Pan Controls to Yahoo! Maps







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway