JS Display Dynamic Time method detailed _javascript skills

Source: Internet
Author: User
Tags getdate local time time and date

This article illustrates the method of JS displaying dynamic time. Share to everyone for your reference, specific as follows:

Method of the Date object

The Date object enables you to obtain the time and date of the operating system relative to the International Standard Time (Greenwich Mean Time, now known as utc-universal coordinated times) or the Flash player running. To use the method of the Date object, you must first create an entity (Instance) of the Date object.

The Date object must use the Flash 5 or later version of the player.

The method of a Date object is not static, but it can be applied to a separate entity that is specified when used.

Introduction to Methods for Date objects:

getdate | Get current date based on local time (date of this month)
Getday | Based on local time get today is the day of the week (0-sunday,1-monday ...)
getFullYear | Get current year (four digits) based on local time
gethours | Gets the current number of hours based on local time (24-hour system, 0-23)
getmilliseconds | Get the current number of milliseconds based on local time
getminutes | Get the current number of minutes based on local time
getmonth | Get the current month based on local time (note starting at 0:0-jan,1-feb ...)
getseconds | Get the current number of seconds based on local time
gettime | Get the number of milliseconds since 1970.1.1 0:00 in UTC format
getTimezoneOffset | Get offset values (in minutes) for the current time and UTC format
getutcdate | Get current date in UTC format (date of this month)
getutcday | Get the UTC format today is the day of the week (0-sunday,1-monday ...)
getUTCFullYear | Get current year in UTC format (four digits)
getutchours | Get the current number of hours in UTC (24 hours, 0-23)
getUTCMilliseconds | Get current number of milliseconds in UTC format
getUTCMinutes | Get the current number of minutes in UTC format
getUTCMonth | Get the current month in UTC format (note starting at 0:0-jan,1-feb ...)
getUTCSeconds | Get the current number of seconds in UTC format
getyear | Get current abbreviated year based on local time (current year minus 1900)
setdate | Set the current date (number of this month)
setFullYear | Set current year (four digits)
sethours | Set the current number of hours (24 hours, 0-23)
Setmilliseconds | Set the current number of milliseconds
setminutes | Set the current number of minutes
Setmonth | Set the current month (note starting at 0:0-jan,1-feb ...)
setseconds | Set the current number of seconds
SetTime | Set the number of milliseconds since 1970.1.1 0:00 in UTC format
setUTCDate | Set the current date in UTC format (date of this month)
setUTCFullYear | Set the current year in UTC format (four digits)
setUTCHours | Set the current number of hours in UTC format (24 hours, 0-23)
setUTCMilliseconds | Set the current number of milliseconds in UTC format
setUTCMinutes | Set the current number of minutes in UTC format
setUTCMonth | Set the current month in UTC format (note starting at 0:0-jan,1-feb ...)
setUTCSeconds | Set the current number of seconds in UTC format
Setyear | Set the current abbreviation year (minus 1900 for the current year)
ToString | Converts a date-time value to a string value in the form of date/time
· DATE.UTC | Returns a fixed time value for the specified UTC format date time

Page JS directly get system Dynamic time Complete Example:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">  

The effect is as shown in the following illustration:

PS: For JavaScript time and date operations interested friends can also refer to the site online tools:

Unix timestamp (timestamp) conversion tool:
Http://tools.jb51.net/code/unixtime

Online Worldwide Time query:
Http://tools.jb51.net/zhuanhuanqi/worldtime

Online Perpetual calendar:
Http://tools.jb51.net/bianmin/wannianli

Web calendar:
Http://tools.jb51.net/bianmin/webwannianli

More about JavaScript related content to view the site topics: "JavaScript time and date Operation skills Summary", "JavaScript switching effects and techniques summary", "JavaScript Search Algorithm Skills summary", " JavaScript animation effects and tips Summary, "JavaScript Error and debugging skills Summary", "JavaScript data structure and algorithm skills summary", "JavaScript traversal algorithm and Skills summary" and "JavaScript Mathematical operation Usage Summary"

I hope this article will help you with JavaScript programming.

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.