Introduction to DATEPART Usage in ASP

Source: Internet
Author: User
Tags constant numeric time interval

DatePart (interval, date[, firstdayofweek[, FirstWeekOfYear])
The syntax for the DatePart function has the following parameters:

Parameter description
Interval must be selected. A string expression that represents the time interval to return. For numeric values, see the "Settings" section.
Date must be selected. The date expression to evaluate.
Firstdayof Week optional. Specifies the constant for the first day of the week. If not specified, the default is Sunday. For numeric values, see the "Settings" section.
FirstWeekOfYear Optional. Specifies a constant for the first week of the year. If not specified, the default is the week of January 1. For numeric values, see the "Settings" section.

' How many days in total are there in a year?

The code is as follows Copy Code
Function dayofyear (ByVal y)
DayOfYear = DatePart ("y",y& "-12-31")
End Function5


Example

The code is as follows Copy Code
Response.Write DayOfYear (2012)

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.