Builtin JavaScript Date and Time Functions Reference Table

Javascript provide us a lot of Date & Time function to resolve our daily problems. In this post i will try to introduce each builtin Date & Time function with proper explanation & example. Most of the times also i can not remember all functions. So i think the below list will surely help all javascript developers. The List of builtin javascript Date & Time Function is given below:

List of builtin javascript Date & Time Function:

Function Name Description Output Range
getDate() Day of the month 1 to 31
getDay() Day of the week 0 to 6
getFullYear() Full 4 digit year >1999
getHours() Hour of the day 0 to 23
getMilliseconds() Count from last second 0 to 999
getMinutes() Count from last hour 0 to 59
getMonth() No of month 0 to 11. Note that 0 represent January
getSeconds() Count from last minute 0 to 59
getTime() Number of milliseconds since January 01, 1970 N/A
getTimezoneOffset() Difference between local time and GMT in minutes 0-1439
getYear() Return Year 0 to 99 for 1900 to 1999 & 4 digit from >1999
setDate() Set date 1-31
setFullYear() Set full year to a date 4 digit year
setHours() Set hour to a date 0-23
setMilliseconds() Set milliseconds to a date Numeric only
setMinutes() Set minute to a date 0 to 59
setMonth() Set month to a date 0 to 11
setSeconds() Set seconds to a date 0 to 59
setYear() Set year to a date Either 2 digit or 4 digit
toGMTString() String: GMT date and time day dd mmm yyyy hh:mm:ss GMT
toLocaleString()toString() String: Local date & time Depends on Operating System(OS) & Browser
valueOf() Number of milliseconds since January 01, 1970 ms
Posted in Client, Javascript

Leave a Reply

Your email address will not be published. Required fields are marked *