JavaScript (eight) Date object

Source: Internet
Author: User
Tags time and seconds

Date Object

1. How to create

var New //The immediate return is now the current time  

return format

(Day of the week, month and minute time zone)

2. Formatting methods for dates

Dateobject.todatestring (); Return to day of the month and year

Dateobject.totimestring (); Return time and seconds time zone

3. Date Time Build Method Dateobject.function ();

getTime () returns the number of milliseconds from 1970 to present (ValueOf () same) settime () set the number of milliseconds from 1970 to present   thus up to Effect to change date
getfullyear () get 4-digit year setfullyear () set year, change the number of milliseconds for a date object
getMonth () get month (starting from 0, so add a   is the current month) setmonth () set Month (out of Gagnin)
getDate () Gets the number of setDate () Set the number (exceeds plus month)
getDay () get Sunday-six   corresponding 0-6    
getHours () Get hours sethours () Set hours (over 24 plus days)
getminutes () get minutes setminutes () set minutes
getseconds () Gets the number of seconds setseconds () set seconds
getmilliseconds () get milliseconds setmilliseconds () set number of milliseconds

JavaScript (eight) Date object

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.