JavaScript Tutorial

JS HomeJS EditorsJS How toJS Basic ProgramJS ConsoleJS VariableJS constJS Data TypesJS StringJS Type CastingJS KeywordsJS OperatorsJS Use StrictJS Escape SequencesJS Comments

JS Control Statements

JS ifJS if elseJS else ifJS BreakJS ContinueJS Switch Case

JS Looping

JS Loop ForJS Loop For InJS Loop WhileJS Loop Do While

JS Array

JS ArrayJS Array One DimensionalJS Array Multi DimensionalJS Array Associative

JS Functions

JS FunctionJS Function SelfJS Function call()JS Function apply()JS Call By ValueJS Call By ReferenceJS Function Closures

JS Scope

JS Scope GlobalJS Scope LocalJS Let

JS File Handling

JS File Handling

JS Error Handling

JS try catchJS throwJS finally

JS Select Particulars

JS getElementByID()JS getElementsByClassName()JS getElementsByTagName()JS getElementsByName()JS querySelector()JS querySelectorAll()

JS Popup

JS alert()JS confirm()JS prompt()

JS Events

JS EventsJS Media EventsJS Mouse EventsJS Keyboard EventsJS Form EventsJS Drag EventsJS Clipboard EventsJS Print EventsJS Animation EventsJS Transition EventsJS Server-Sent EventsJS Touch EventsJS Object Events

JS Methods

JS Array MethodsJS String MethodsJS Math MethodsJS Number MethodsJS Date MethodsJS Element MethodsJS Window MethodsJS Node MethodsJS Document MethodsJS Console MethodsJS Timing MethodsJS Navigator MethodsJS Miscellaneous Methods

JS Properties

JS Array PropertiesJS String PropertiesJS Number PropertiesJS MouseEvent PropertiesJS KeyboardEvent PropertiesJS AnimationEvent PropertiesJS TransitionEvent PropertiesJS Element PropertiesJS Window PropertiesJS Node PropertiesJS Document PropertiesJS Navigator PropertiesJS HashChangeEvent PropertiesJS Miscellaneous Properties

JS Regular Expressions

JS Regexp

JS Cookies

JS Cookies

JS Interview Programs

JS Common ProgramsJS Array ProgramsJS Converter ProgramsJS Star Patterns ProgramJS Number Patterns ProgramJS Alphabet Patterns Program

JS Reference

LEARN JSONLEARN AJAXMIME TypesASCII Table

JavaScript Date Methods

Last Updated:

Date Methods

The following table provides a list of all Date methods available in JavaScript.

EventExplanation
getDate() Returns the day of the month (from 1 to 31)
getDay() Returns the day of the week (from 0-6)
getFullYear() Returns the year (in 4 digits)
getHours() Returns the hour (from 0-23)
getMilliseconds() Returns the milliseconds (from 0-999)
getMinutes() Returns the minutes (from 0-59)
getMonth() Returns the month (from 0-11)
getSeconds() Returns the seconds (from 0-59)
getTime() Returns the numeric value of the specified date as the number of milliseconds since January 1, 1970, 00:00:00 UTC (negative for prior times)
getTimezoneOffset() Returns the time-zone offset in minutes for the current locale.
getUTCDate() Returns the day of the month, according to universal time (from 1-31)
getUTCDay() Returns the day of the week, according to universal time (from 0-6)
getUTCFullYear() Returns the year, according to universal time (in 4 digits)
getUTCHours() Returns the hour, according to universal time (from 0-23)
getUTCMilliseconds() Returns the milliseconds, according to universal time (from 0-999)
getUTCMinutes() Returns the minutes, according to universal time (from 0-59)
getUTCMonth() Returns the month, according to universal time (from 0-11)
getUTCSeconds() Returns the seconds, according to universal time (from 0-59)
now() Returns the numeric value corresponding to the current time - the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC, with leap seconds ignored
parse() Parses a string representation of a date and returns the number of milliseconds since 1 January, 1970, 00:00:00, UTC, with leap seconds ignored
setDate() Sets the day of the month of a date object
setFullYear() Sets the year of a date object
setHours() Sets the hour of a date object
setMilliseconds() Sets the milliseconds of a date object
setMinutes() Set the minutes of a date object
setMonth() Sets the month of a date object
setSeconds() Sets the seconds of a date object
setTime() Sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC, allowing for negative numbers for times prior
setUTCDate() Sets the day of the month of a date object, according to universal time
setUTCFullYear() Sets the year of a date object, according to universal time
setUTCHours() Sets the hour of a date object, according to universal time
setUTCMilliseconds() Sets the milliseconds of a date object, according to universal time
setUTCMinutes() Set the minutes of a date object, according to universal time
setUTCMonth() Sets the month of a date object, according to universal time
setUTCSeconds() Set the seconds of a date object, according to universal time
toDateString() Converts the date portion of a Date object into a readable string
toISOString() Converts a date to a string following the ISO 8601 Extended Format
toJSON() Returns a string representing the Date using toISOString(). Intended for use by JSON.stringify()
toLocaleDateString() Returns a string with a locality sensitive representation of the date portion of this date based on system settings
toLocaleTimeString() Returns a string with a locality sensitive representation of the time portion of this date based on system settings
toLocaleString() Converts a Date object to a string, using locale conventions
toTimeString() Returns the "time" portion of the Date as a human-readable string
toUTCString() Converts a date to a string using the UTC timezone
UTC() Returns the number of milliseconds since January 1, 1970, 00:00:00 UTC, with leap seconds ignored
valueOf() Returns the primitive value of a Date object

Share this Page

Meet the Author