How JavaScript operates on time

Source: Internet
Author: User
Tags local time

The Date object is an internal data type of JavaScript.
The Date object has no properties that can be read and written directly, and all access to date and time values is performed through its methods.

Date and time of day returned by date ()
GetDate () Returns a day from the Date object in one months (1 ~ 31)
GetDay () Returns a day of the week from a Date object (0 ~ 6)
GetMonth () returns the month from the Date object (0 ~ 11)
getFullYear () returns the year as a four-digit number from a Date object
GetYear () returns the year as a two-bit or four-digit number from a Date object.
GetHours () returns the hour of the Date object (0 ~ 23)
Getminutes () returns the minute of the Date object (0 ~ 59)
Getseconds () returns the number of seconds of the date object (0 ~ 59))
Getmilliseconds () returns the milliseconds of the Date object (0 ~ 999)
GetTime () returns the number of milliseconds since January 1, 1970
getTimezoneOffset () returns the minute difference between local time and Greenwich Mean Time (GMT)
getUTCDate () Day of the month from the Date object, based on world time (1 ~ 31)
GetUTCDay () Returns the day of the week from the Date object according to the world (0 ~ 6)
getUTCMonth () returns the month from a Date object according to the world (0 ~ 11)
getUTCFullYear () returns a four-digit year from a Date object based on world time
getUTCHours () the hour (0 ~ 23) of returning a Date object according to the GMT
getUTCMinutes () minute (0 ~ 59) of returning a Date object according to the Universal
getUTCSeconds () returns the second of a Date object according to the universal (0 ~ 59)
getUTCMilliseconds () milliseconds to return a Date object based on the universal (0 ~ 999)
Parse () returns the number of milliseconds from midnight January 1, 1970 to a specified date (string)
SetDate () sets a day of the month in the Date object (1 ~ 31))
Setmonth () sets the month (0 ~ 11) in the Date object
setFullYear () sets the year (four digits) in the Date object
Setyear () sets the year (two-bit or four-digit number) in the Date object.
Sethours () Sets the hour in the Date object (0 ~ 23)
Setminutes () Sets the minutes in the Date object (0 ~ 59)
Setseconds () Sets the seconds in the Date object (0 ~ 59)
Setmilliseconds () Sets the milliseconds in the Date object (0 ~ 999)
SetTime () calculates the date and time by adding or subtracting a specified number of milliseconds to or from midnight January 1, 1970
SetUTCDate () Sets the day of the month in the Date object according to the world time (1 ~ 31)
setUTCMonth () Sets the month in the Date object according to the world time (0 ~ 11)
setUTCFullYear () sets the year (four digits) of the Date object according to the world time
setUTCHours () Sets the Date object in hours (0 ~ 23) According to the world time
setUTCMinutes () Sets the Date object in minutes (0 ~ 59) According to the world time
setUTCSeconds () Sets the Date object in seconds (0 ~ 59) According to the world time
setUTCMilliseconds () Sets the Date object in milliseconds s (0 ~ 999) According to the world time
Tosource () represents the source code of the object
ToString () Converts the Date object to a string.
toTimeString () Converts the time portion of a Date object to a string.
toDateString () Converts the date part of a Date object to a string.
toGMTString () Converts the Date object to a string, based on Greenwich mean.
toUTCString () Converts the Date object to a string based on the universal.
toLocaleString () Converts a Date object to a string based on the local time format.
toLocaleTimeString () Converts the time portion of a Date object to a string, based on the local time format
toLocaleDateString () Converts the date part of a Date object to a string based on the local time format
UTC () Gets a date based on the time of day, and then returns the number of milliseconds from midnight January 1, 1970 to that date.
ValueOf () returns the original value of the Date object.

How JavaScript operates on time

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.