JavaScript Date Object

From Techotopia
Revision as of 20:39, 1 May 2007 by Neil (Talk | contribs)

Jump to: navigation, search

The JavaScript Date object enables you to work with, and manipluate time (and no, it doesn't enable you to travel back through time to buy a lottery ticket with this week's winning numbers - if it did that I would have already done it, and would be sitting on beach somewhere instead of writing this book).

The Date object enables the JavaScript develper to create a Date object initialized to a specific time and date, or to create a date object that reflects the current time on the computer on which the browser is running. There are two important things to note when working with the Date oject. Firstly, when reading the date and time of the user's computer you are dependent on the user having set the correct day and time. Secondly, whilst you can read the date and time set on the user's computer, and change those settings within your Data object instance, you cannot change the date and time on the user's computer.

Creating a JavaScript Date Object