Javascript provides number of methods to get date time and set date time.
Date() | Creates date object and returns current date time. |
getDate() | Gets day of the month from 0- 31 |
now() | Gives number of milliseconds passed since 1 January 1970. |
getFullYear() | Returns current Year or if date time passed as parameter, returns Year as per date time. |
getDay() | Returns Day of the week from 0-6. |
getMonth() | Gives Month in from 0 – 11. |
getHours() | Gives Hour in 24 hour format (0-23). |
getMinutes() | Gives Minutes from 0 to 59. |
getSeconds() | Returns Second from 0 – 59 |
getTime() | |
getTimezoneOffset() | Gives UTC time and local time difference in minutes. |
getUTCDate() | Gives Current Date of Month, as per Universal time |
getUTCDay() | Gives Current Day of week, as per Universal time |
getUTCFullYear() | Gives Current Year, as per Universal time |
getUTCHours() | Gives Current Hour, as per Universal time |
getUTCMilliseconds() | Gives Current Millisecond, as per Universal time |
getUTCMinutes() | Gives Current Minute, as per Universal time |
getUTCMonth() | Gives Current Month, as per Universal time (0 -11) |
getUTCSeconds() | Gives Current Second, as per Universal time (0 -59) |
setDate() | Sets Date and return full date time with timezone |
setFullYear() | Sets Year and return full date time with timezone |
setHours() | Sets Hour and return full date time with timezone |
setMilliseconds() | Sets Milliseconds and return full date time with timezone |
setMinutes() | Sets Minutes and return full date time with timezone |
setMonth() | Sets Month and return full date time with timezone |
setSeconds() | Sets Seconds and return full date time with timezone |
setTime() | Creates Date and time by adding/subtracting milliseconds to 1 January, 1970 with timezone |
setUTCDate() | Sets UTC Date and return full date time with timezone |
setUTCFullYear() | Sets UTC Year and return full date time with timezone |
setUTCHours() | Sets UTC Hours and return full date time with timezone |
setUTCMilliseconds() | Sets UTC Milliseconds and return full date time with timezone |
setUTCMinutes() | Sets UTC Minutes and return full date time with timezone |
setUTCMonth() | Sets UTC Month and return full date time with timezone |
setUTCSeconds() | Sets UTC Second and return full date time with timezone |
toDateString() | Gives Date in String format |
toISOString() | Gives Date as string in ISO standard format |
toJSON() | Gives Date in JSON format |
toLocaleDateString() | Gives only Date in Locale date format. |
toLocaleTimeString() | Gives only Time in Locale time format. |
toLocaleString() | Gives only Date Time in Locale date format. |
toString() | Gives Date object in string format |
toTimeString() | Gives Date object in string format with timezone |
toUTCString() | Gives Date object in UTC string format with timezone |
UTC() | Gives milliseconds passed since 1 January 1970 |
valueOf() |