JavaScript Reference :: Date

There are several constructor methods for the Date object, any of which are easily used.

methods

int getDate()
Returns the day of the month.
int getDay()
Returns an integer representing the day of the week between 0 (Sunday) and 6 (Saturday).
int getFullYear()
Returns the four-digit year.
int getHours()
Returns an integer between 0 and 23 representing the hour.
int getMilliseconds()
Returns the number of milliseconds.
int getMinutes()
Returns the number of minutes.
int getMonth()
Returns a number between 0 (January) and 11 (December) representing the month.
int getSeconds()
Returns the number of seconds.
int getTime()
Returns the number of milliseconds since 01-JAN-70 00:00:00.000.
int getTimezoneOffset()
Returns the number of minutes between the local timezone and GMT (UTC).
int getUTCDate()
Returns the day of the month in GMT.
int getUTCDay()
Returns an integer between 0 (Sunday) and 6 (Saturday) for GMT.
int getUTCFullYear()
Returns the year, including the century for GMT.
int getUTCHours()
Returns an integer between 0 and 23 representing the hour in GMT.
int getUTCMilliseconds()
Returns the number of milliseconds since 01-JAN-70 00:00:00.000 GMT.
int getUTCMinutes()
Returns the number of minutes GMT.
int getUTCMonth()
Returns a number between 0 (January) and 11 (December) for GMT.
int getUTCSeconds()
Returns the number of seconds for GMT.
int parse(string)
Returns the number of milliseconds between 01-JAN-70 00:00:00.000 and the date passed as a string. If the value passed is not a valid date, the value returned is not a number (NaN).
void setDate(int)
Sets the day of the month. Value passed must be between 1 and 31.
void setFullYear(int)
Sets the year.
void setHours(int)
Sets the hour. Value passed must be between 0 and 23.
void setMilliseconds(int)
Sets the date and time relative to 01-JAN-70 00:00:00.000.
void setMinutes(int)
Sets the number of minutes. Value passed must be between 0 and 59.
void setMonth(int)
Sets the month. Value passed must be between 0 (January) and 11 (December).
void setSeconds(int)
Sets the number of seconds.
void setTime(int)
Sets the date and time by adding the number passed (as milliseconds) to 01-JAN-70 00:00:00.000.
void setUTCDate(int)
Sets the day of the month using GMT. Value passed must be between 1 and 31.
void setUTCFullYear(int)
Sets the year using GMT.
void setUTCHours(int)
Sets the hour using GMT.
void setUTCMilliseconds(int)
Sets the milliseconds using GMT.
void setUTCMinutes(int)
Sets the minutes using GMT.
void setUTCMonth(int)
Sets the month using GMT. Value passed must be between 0 (January) and 11 (December).
void setUTCSeconds(int)
Sets the seconds using GMT.
string toGMTString()
Returns the GMT time as a string in UTC format, e.g. Fri, 29 Oct 1999 16:28:58 UTC.
string toLocaleString()
Returns the time, formatted according to the locale date conventions, e.g. 31/12/1999 00:00:00.
object toSource()
Returns a literal representing the source code of the object e.g "function Object() { [native code] }" or "function Car(manufactuer, model, productionyear) { this.make = manufactuer; this.model = model; this.year = productionyear; }".
string toString()
Returns a string representing the object i.e. "[object Object]".
string toUTCString()
Returns the local time in the UTC format.
void unwatch(property)
Removes a previously set watchpoint.
								
int UTC(year, month, day[, hours, minutes, seconds])
Returns the number of milliseconds passed between 01-JAN-70 00:00:00.000 and the date specified.
object valueOf()
Returns the primitive value of the object e.g. "function Object() { [native code] }".
void watch(property, handlingFunction)
Calls the handlingFunction when the property is changed.
								

properties

events