See Also Example
Returns a specified part of a given date.
DatePart( interval, date )
The DatePart function uses the following parts:
interval String expression that is the interval of time you want to return.
date Date that you want to inspect.
You can use the DatePart function to inspect a date and return a specific interval of time. For example, you might use DatePart to calculate the day of the week or the current hour.
The following table lists the valid time periods and their interval values. These intervals are also used by the Format function.
Time period Interval
Day of Year y
For Weekday, Sunday = 1, Monday = 2, and so on.
Distribution Note When you create and distribute applications that use this function in your code (not necessary if included only in SQL statements for your database), you should install the file MSAFINX.DLL in the customer's Microsoft Windows \SYSTEM directory. The Visual Basic Setup Kit provides tools to help you write setup programs that install your applications.