VBS TUTORIAL: function-dateserial function _vbs

Source: Internet
Author: User

DateSerial function

Returns a Variantof the date subtype for the specified year, month, and day.

DateSerial(year, month, day)

Arguments

Year

A numeric or numeric expression from 100 to 9999.

Month

An arbitrary numeric expression.

Day

An arbitrary numeric expression.

Description

To specify a date, such as December 31, 1991, the range of values for each parameter in theDateSerial function should be acceptable; The value of the day should be between 1 and 31, and the month should be between 1 and 12. However, you can also specify a relative date for each parameter by using a numeric expression that represents the number of years, months, or days before or after a day.

The following sample uses a numeric expression instead of an absolute date. Here, theDateSerial function returns the date of 10 years (1990-10) 2 months (8-2) and one day (1-1) before August 1, 1990: May 31, 1980.

DateSerial(1970, 1, 1)' Returns January 1, 1970.DateSerial(1990 - 10, 8 - 2, 1 - 1)' Returns May 31, 1980.

For The year parameter, if the value range is from 0 to 99, it is interpreted as 1900-1999 years. For year parameters outside of this range, four-digit numbers are used to represent years (for example, 1800).

When the value of any parameter exceeds an acceptable range, it is appropriately rounded to the next larger time unit. For example, if you specify 35 days, the number of days is interpreted as a month plus extra days, depending on the year and month. However, an error occurs if the parameter value exceeds the range of 32,768 to 32,767, or if the date specified by three parameters, whether directly or through an expression, is outside the acceptable date range.

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.