Firefox getyear () getfullyear number to obtain the year

Source: Internet
Author: User

The getyear () function of JavaScript is intended to obtain the current "year", for example: <textarea id="runcode44642"></textarea>
[Ctrl + A select all Note: If you need to introduce external JS, You need to refresh it to execute]

Run "2008" in IE, but "108" in Firefox and other browsers ". The reason is that in Firefox and other browsers, getyear returns the value of "current year minus 1900" (that is, the year base is 1900 ). Microsoft Internet Explorer adds 2000 directly when the today year is greater than or equal to 1900, and returns 200 * instead of 10 *. For Firefox and other browsers, you can use the followingCode:
[Ctrl + A select all Note: If you need to introduce external JS, You need to refresh it to execute]

of course, we can also directly use the getfullyear () function:
[Ctrl + A select all Note: To introduce external JS, refresh it before execution]

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.