C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...








The Date Object



This article explains about the JavaScript Date object






The other important JavaScript object is Date Object. In order to work with date and time it’s used. As all of us know that JavaScript is a client side language and the script runs on the client, therefore it will always return the date/time of the client. You can use date object to display a "countdown," such as the number of days left
for the favorite movie to release .

Instantiating Date Object can be done on either of these ways.

new Date()
new Date(milliseconds)
new Date(dateString)
new Date(year, month, day, hours, minutes, seconds, milliseconds) //most parameters here are optional. Not specifying causes 0 to be passed in.

Example



day = new Date()
day = new Date("August15, 2006 08:25:00")
day = new Date(06,8,15)
day = new Date(06,8,15,8,25,0)

Methods



• getHours() - Returns the hour
• getMinutes() - Returns the minutes
• getSeconds() - Returns the seconds
• getYear() - Returns the year ("06" is 2006)
• getMonth() - Returns the month ( returns "0" is if month is January)
• getDate() - Returns the day of the month
• getDay() - Returns the day of the week ( returns "0" is if week is Sunday)






Next Chapter: Date object's' getDate() method


Previous Chapter: The string Object


Tutorial Index




Read TATA Nano reviews.
dotNet Slackers   BizTalk Adaptors    Web Design   Scripts
Are you waiting for engineering entrance result? Watch here for engineering entrance results.
it help desk

Contact Us    Privacy Policy    Terms Of Use