JavaScript Date Functions

EditRocket provides the following information on Date functions in the JavaScript source code builder.

Date () - Returns today's date and time

getDate () - Returns the day of the month from a Date object (from 1-31)

getDay () - Returns the day of the week from a Date object (from 0-6)

getMonth () - Returns the month from a Date object (from 0-11)

getFullYear () - Returns the year, as a four-digit number, from a Date object

getYear () - Returns the year, as a two-digit or a four-digit number, from a Date object

getHours () - Returns the hour of a Date object

getMinutes () - Returns the minutes of a Date object (from 0-59)

getSeconds () - Returns the seconds of a Date object (from 0-59)

getMilliseconds () - Returns the milliseconds of a Date object (from 0-999)

getTime () - Returns the number of milliseconds since midnight Jan 1, 1970

getTimezoneOffset () - Returns the difference in minutes between local time and Greenwich Mean Time (GMT)

getUTCDate () - Returns the day of the month from a Date object according to universal time (from 1-31)

getUTCDay () - Returns the day of the week from a Date object according to universal time (from 0-6)

getUTCMonth () - Returns the month from a Date object according to universal time (from 0-11)

getUTCFullYear () - Returns the four-digit year from a Date object according to universal time

getUTCHours () - Returns the hour of a Date object according to universal time (from 0-23)

getUTCMinutes () - Returns the minutes of a Date object according to universal time (from 0-59)

getUTCSeconds () - Returns the seconds of a Date object according to universal time (from 0-59)

getUTCMilliseconds () - Returns the milliseconds of a Date object according to universal time (from 0-999)

parse(datestring) - Takes a date string and returns the number of milliseconds since midnight of January 1, 1970

setDate (day) - Sets the day of the month in a Date object (from 1-31)

setMonth (month[,day]) - Sets the month in a Date object (from 0-11)

setFullYear(year[,month[,day]]) - Sets the year in a Date object (four digits)

setYear (year) - Sets the year in the Date object (two or four digits)

setHours (hour[,minute[,second[,millisecond]]]) - Sets the hour in a Date object (from 0-23)

setMinutes (minute[,second[,millisecond]]) - Set the minutes in a Date object (from 0-59)

setSeconds (second[,millisecond]) - Sets the seconds in a Date object (from 0-59)

setMilliseconds (millisecond) - Sets the milliseconds in a Date object (from 0-999)

setTime (millisecond) - Calculates a date and time by adding or subtracting a specified number of milliseconds to/from midnight January 1, 1970

setUTCDate (day) - Sets the day of the month in a Date object according to universal time (from 1-31)

setUTCMonth(month[,day]) - Sets the month in a Date object according to universal time (from 0-11)

setUTCFullYear (year[,month[,day]]) - Sets the year in a Date object according to universal time (four digits)

setUTCHours (hour[,minute[,second[,millisecond]]]) - Sets the hour in a Date object according to universal time (from 0-23)

setUTCMinutes (minute[,second[,millisecond]]) - Set the minutes in a Date object according to universal time (from 0-59)

setUTCSeconds (second[,millisecond]) - Set the seconds in a Date object according to universal time (from 0-59)

setUTCMilliseconds (millisecond) - Sets the milliseconds in a Date object according to universal time (from 0-999)

toSource () - Represents the source code of an object

toString () - Converts a Date object to a string

toGMTString () - Converts a Date object, according to Greenwich time, to a string

toUTCString () - Converts a Date object, according to universal time, to a string

toLocaleString () - Converts a Date object, according to local time, to a string

UTC (year,month,day[,hours[,minutes[,seconds[,milliseconds]]]]) - Takes a date and returns the number of milliseconds since midnight of January 1, 1970 according to universal time

valueOf () - Returns the primitive value of a Date object