Display current time and countdown function based on JavaScript _javascript tips

Source: Internet
Author: User
Tags getdate local time

Self-practice, by the way to share a piece of JS native code.
The Date object is used to process dates and times.
Date () Returns the day and time.
GetDate () returns one day of one months (1 ~ 31) from the Date object.
Getday () returns one day of the week from the Date object (0 ~ 6).
GetMonth () returns the month (0 ~ 11) from the Date object.
getFullYear () returns the year with a four-digit number from the Date object.
GetYear () Please use the getFullYear () method instead.
GetHours () returns the hour of the date object (0 ~ 23).
Getminutes () returns the minute (0 ~ 59) of the Date object.
Getseconds () returns the number of seconds (0 ~ 59) of the Date object.
Getmilliseconds () returns the milliseconds (0 ~ 999) of the Date object.
GetTime () returns the number of milliseconds since January 1, 1970.
getTimezoneOffset () returns the minute difference between local time and Greenwich Mean Time (GMT).
getUTCDate () Returns the day of the month from the Date object (1 ~ 31) according to the world.
getUTCDay () Returns the day of the week (0 ~ 6) from the Date object according to the world.
getUTCMonth () returns the month (0 ~ 11) from the Date object according to the world.
getUTCFullYear () returns a four-digit year from the Date object based on the world.
getUTCHours () returns the hour (0 ~ 23) of the date object according to the universal.
getUTCMinutes () returns the minute (0 ~ 59) of the date object according to the universal.
getUTCSeconds () returns the second (0 ~ 59) of the date object according to the universal.
getUTCMilliseconds () returns the millisecond (0 ~ 999) of the date object according to the universal.
Parse () returns the number of milliseconds from midnight January 1, 1970 to the specified date (string).
Setdate () Sets the 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 () Please use the setFullYear () method instead.
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 () Sets the Date object in milliseconds.
setUTCDate () Sets the day of the month in the Date object according to the world (1 ~ 31).
setUTCMonth () sets the month (0 ~ 11) in the date object according to the world.
setUTCFullYear () sets the year (four digits) in the Date object based on the world.
setUTCHours () sets the hour (0 ~ 23) in the date object according to the world.
setUTCMinutes () sets the minute (0 ~ 59) of the date object according to the world.
setUTCSeconds () sets the second (0 ~ 59) of the Date object according to the world.
setUTCMilliseconds () sets the millisecond (0 ~ 999) in the Date object according to the world.
Tosource () returns the source code for the object.
ToString () Converts the Date object to a string.
toTimeString () Converts the time portion of the Date object to a string.
toDateString () Converts the date part of a Date object to a string.
toGMTString () Please use the toutcstring () method instead.
toUTCString () Converts a Date object to a string based on the universal.
toLocaleString () Converts the 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 () returns the number of milliseconds from January 1, 1970 to a specified date based on the universal.
ValueOf () returns the original value of the Date object.
Specific implementation code:

<! DOCTYPE html>  

The above is the entire content of this article, I hope to learn JavaScript program to help you.

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.