JavaScript
  Home arrow JavaScript arrow JavaScript Objects: Dates
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  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
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 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
     
     
    ADVERTISEMENT


    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

    - Comparing Fields and Customizing Error Messa...
    - Checking Numbers and File Extensions with jQ...
    - Validating Digits and Dates with jQuery`s Va...
    - Validating Ranges, Emails, and URLs with jQu...
    - More Uses for the jQuery Tooltip Plug-in`s b...
    - Building Image-Based Tooltips with the jQuer...
    - Using the jQuery Tooltip Plug-in`s bodyHandl...
    - Using Rangelength, Min and Max with the Vali...
    - Using Minlength and Maxlength with the Valid...
    - Modifying Tooltip Coordinates with the jQuer...
    - Applying a Fade Out Effect with the jQuery T...
    - Tracking Mouse Movements with the jQuery Too...
    - Checking Online Forms with the Validator jQu...
    - Nested JavaScript Functions as Objects
    - The jQuery Tooltip Plug-in







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek