JavaScript
  Home arrow JavaScript arrow JavaScript Objects: Dates
IBM Developerworks
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  
Download TestComplete 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
IBM Developerworks
 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 Objects: Dates
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-02-04

    Table of Contents:
  • JavaScript Objects: Dates
  • The Prototype Property
  • The Date() Method
  • The GetDate() Method
  • The GetMonth() Method

  • 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
     
     
    Iron Speed
     
    ADVERTISEMENT

    Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    JavaScript Objects: Dates
    (Page 1 of 5 )

    In the last tutorial we discussed the last of the String Objects. We left off with two to go, but one of those two doesn't work in IE (and therefore is not worth mentioning; VIVE BILL GATES!) and the other is code that JavaScript creates automatically for you. So I guess what I am saying here is I am not going to discuss those. I will however discuss my good buddy, the Date Object.The Date Object is made up of both Properties and Methods. Before we look at the Methods, let's go over the Properties.

     

    Property

    What it Does

    Constructor

    Returns the function that created it

    Prototype

    Used to add properties and methods to an object

    Constructor

    The Date Constructor Property works similar to the Constructor in the String Object. It returns the function that created it. Here it is in code:


    <html>

    <body>


    <script type="text/javascript">


    var when=new Date()


    if (when.constructor==Array)

    {document.write("This object is an Array object")}

    if (when.constructor==Boolean)

    {document.write("This object is a Boolean object")}

    if (when.constructor==Date)

    {document.write("This object is a Date object")}

    if (when.constructor==String)

    {document.write("This object is a String object")}


    </script>


    </body>

    </html>

    This will print out:

      This object is a Date object

    More JavaScript Articles
    More By James Payne


       · Thanks for dropping by. Here, in this tutorial, we begin our discussion of the...
     

    JAVASCRIPT ARTICLES

    - 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
    - Adding Zoom Controls to Yahoo! Maps
    - Working with Yahoo! Maps
    - Building Image Zooming Controls with the DOM...
    - Working with Multiple Graphics for a Zoom Ap...
    - Improving an Image Zooming Application with ...
    - Zooming in on Images with JavaScript
    - JavaScript Date Objects: Universal Coordinat...
    - Javascript Objects: More Date Methods
    - JavaScript Objects: Dates
    - JavaScript Objects: Finishing Strings

    Iron Speed





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