Difference between revisions of "JavaScript Date Object"

From Techotopia
Jump to: navigation, search
Line 1: Line 1:
 
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 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 ''system time'' on the computer on which the browser is running. There are two important things to note when working with the JavaScript Date object. Firstly,  when reading the date and time of the user's computer you are completely at the mercy of the user's ability to set the correct day and time on their computer. Secondly, whilst you can read the system date and time set on the user's computer, and change those settings within your Data object instance, you ''cannot'' change the computer's system date and time. No matter what methods you call or properties you change on your Date object, the user's system date and time remain unaltered.
+
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 ''system time'' on the computer on which the browser is running. There are two important things to note when working with the JavaScript Date object. Firstly,  when reading the date and time of the user's computer you are completely at the mercy of the user's ability to set and maintain the correct day and time on their computer. Secondly, whilst you can read the system date and time set on the user's computer, and change those settings within your Date object instance, you ''cannot'' change the computer's system date and time. No matter what methods you call or properties you change on your Date object, the user's system date and time remain unaltered.
  
 
== Creating a JavaScript Date Object ==
 
== Creating a JavaScript Date Object ==

Revision as of 20:43, 1 May 2007

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 system time on the computer on which the browser is running. There are two important things to note when working with the JavaScript Date object. Firstly, when reading the date and time of the user's computer you are completely at the mercy of the user's ability to set and maintain the correct day and time on their computer. Secondly, whilst you can read the system date and time set on the user's computer, and change those settings within your Date object instance, you cannot change the computer's system date and time. No matter what methods you call or properties you change on your Date object, the user's system date and time remain unaltered.

Creating a JavaScript Date Object