Home arrow JavaScript arrow JavaScript Objects: Dates
JAVASCRIPT

JavaScript Objects: Dates


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.

Author Info:
By: James Payne
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
February 04, 2008
TABLE OF CONTENTS:
  1. · JavaScript Objects: Dates
  2. · The Prototype Property
  3. · The Date() Method
  4. · The GetDate() Method
  5. · The GetMonth() Method

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
JavaScript Objects: Dates
(Page 1 of 5 )

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


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 6 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials