JScript Method-GetYear method

Source: Internet
Author: User
Returns the year value in a Date object.
Dateobj.getyear ()
The required option Dateobj parameter is a Date object.
Description
This method is outdated and is provided to maintain backward compatibility. Use the getFullYear method instead.
For the 1900-1999 period, the returned year value is a two-digit integer that represents the gap between the saved year and the 1900 year. and the
In other years, the return value is a four-bit integer. For example, the return value for 1996 is 96, and the return value for 1825 and 2025 corresponds to
1825 and 2025.
Note for JScript version 1.0, the value returned by getyear is always the difference between the year in the Date object and the year 1900. For example, the return of 1899
The value is-1, and the return value for 2000 is 100.
Example
The following example illustrates the use of the GetYear method.
function Datedemo () {
var d, s = "Today's date is:";
D = new Date ();
S + + (D.getmonth () + 1) + "/";
S + + d.getdate () + "/";
S + + d.getyear ();
return (s);
}
Requirements
Version 1

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.