6 - Javascript:Objects - The Date object
The Date object is used to work with dates and times.
To create an instance of the Date object and assign it to a variable called "d", you do the following:
var d=new Date()
After creating an instance of the Date object, you can access all the methods of the Date object from the "d" variable.
To return the current day in a month (from 1-31) of a Date object, write the following:
d.getDate()
The Date object can also have the following parameters:
new Date(milliseconds)
new Date(dateString)
new Date(yr_num, mo_num, day_num [, hr_num, min_num, sec_num, ms_num])
milliseconds - the number of milliseconds since 01 January, 1970 00:00:00
dateString - the date in a format that is recognized by the Date.parse method
yr_num, mo_num, day_num - the year, month or day of the date
hr_num, min_num, sec_num, ms_num - the hours, minutes, seconds and milliseconds
If you only use Date(), JavaScript creates an object for today's date according
to the time on the local machine.
So let's experiment with a simple Date function,
a simple Time function,
and a function that uses an array to show the Day of the Week.
A good list of JavaScript objects can be found here.
(from w3schools.com)