Working with dates
It is simple to get going with time and date values in JavaScript. It begins with creating an instance of the Date object:
var d = new Date();This returns an instance of the Date object in the variable d using the current date and time. The Date object includes numerous methods and properties for accessing and manipulating its value. The following list includes methods for accessing date values:
- getDate(): Returns the day of the month.
- getDay(): Returns the day of the week. The week begins with Sunday (0 - 6).
- getFullYear(): Returns the four-digit year.
- getMonth(): Returns the month.
- getYear(): Returns the two-digit year.
- getUTCDate(): Returns the day of the month according to the Coordinated Universal Time (UTC).
- getUTCMonth(): Returns the month according to the UTC (0 - 11).
- getUTCFullYear(): Returns the four-digit year according to the UTC.
An important note regarding JavaScript and dates is it uses the number of milliseconds from midnight January 1, 1970 to store dates. This is called the epoch, and any dates and times before this date are not allowed.
Do you need help with Web Technologies? 





1
Sudip Dey - 05/03/08
codes are simple to understand....also give code which autorefresh the time....
I need your comments also....
» Report offensive content
2
Linda - 01/10/08
As part of my job, I add an expiration date to secured spec. The date is to be 1 week from the day someone prints or opens a specific spec. My problem is that it only works on 98 computers and not XP. I inherited the code and am not too familar with JavaScrip. Can you tell me why this does not work on XP computers?
Thanks for you time.
» Report offensive content