Get and Set method in Date object : Introduction « Date « JavaScript Tutorial






The Date object represents all aspects of a date and time from year to milliseconds.

getDate()Returns the day of the month.
getDay()Returns the day of the week.
getFullYear()Returns the year in local time with four digits.
getHours()Returns the hour.
getMilliseconds()Returns the milliseconds.
getMinutes()Returns the minutes.
getMonth()Returns the month.
getSeconds()Returns the seconds.
getTime()Returns the date and time in milliseconds.
getTimezoneOffset()Returns the time zone offset from GMT in minutes.
getUTCDate()Returns the day of the month converted to universal time.
getUTCDay()Returns the day of the week converted to universal time.
getUTCFullYear()Returns four-digit representation of the year converted to universal time.
getUTCHours()Return the hour converted to universal time.
getUTCMilliseconds()Returns the milliseconds converted to universal time.
getUTCMinutes()Returns the minutes converted to universal time.
getUTCMonth()Returns the month converted to universal time.
getUTCSeconds()Returns the seconds converted to universal time.
getYear()Returns the year as either four-digits or two-digits.
parse()Converts a string, representing a date and time, into milliseconds.
setDate()Sets the day of the month.
setFullYear()Sets year as a four-digit number.
setHours()Sets the hour.
setMilliseconds()Sets the milliseconds.
setMinutes()Sets the minutes.
setMonth()Sets the month.
setSeconds()Sets the seconds.
setTime()Sets the date and time from a millisecond representation of a date and time.
setUTCdate()Sets the day of the month in universal time.
setUTCFullYear()Sets the year as a four-digit number in universal time.
setUTCHours()Sets the hour in universal time.
setUTCMilliseconds()Sets the milliseconds in universal time.
setUTCMinutes()Sets the minutes in universal time.
setUTCMonth()Sets the month in universal time.
setUTCSeconds()Sets the seconds in universal time.
setYear()Sets the year as either a four-digit number or a two-digit number.
toGMTString()Return the data and time as a string in universal time (GMT).
toLocalString()Return the date and time as a string in local time format.
toSource()Return the source of the Date object.
toString()Return the date and time as a string in local time.
toUTCString()Return the data and time as a string in universal time (GMT).
UTC()Convert a universal date and time (GMT) to milliseconds.


12.1.Introduction
12.1.1.Get and Set method in Date object