Introduction to the use of the setUTCFullYear () method in JavaScript _ basics

Source: Internet
Author: User

The JavaScript date.setutcfullyear () method will be the specified date for the whole year according to the Universal Time.
Grammar

Date.setutcfullyear (yearvalue[, monthvalue[, Dayvalue])

Note: The data inside and outside the brackets is optional

The following are the details of the parameters:

    • Yearvalue: An integer that specifies the numeric value of the year, for example, 2008 years.
    • Monthvalue: A month from 0 to 11 of integers, from January to December.
    • An integer dayvalue:1 to 31 that represents the day of the month. If you specify the Dayvalue parameter, you must also specify Monthvalue.

If you do not specify Monthvalue and Dayvalue parameters, the values returned from the GetMonth and GetDate methods are used. If the specified parameter is outside the expected range, call setUTCFullYear the other parameters that you are trying to update and the date information for the dates object. For example, if you specify 15 for Monthvalue, the year is incremented by 1 (year + 1), and 3 is used to represent the month.
return Value:

    • NA

Example:

 
 

This will produce the following results:

 
 

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.