
DatePart Function | 225
The Language
Reference
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
See Also
DateAdd Function
DatePart Function
Class
Microsoft.VisualBasic.DateAndTime
Syntax
DatePart(interval, dateValue[, firstDayOfWeekValue[, _
firstWeekOfYearValue]])
interval (required; String or DateInterval enumeration)
A
String expression or Microsoft.VisualBasic.DateInterval enumeration item indi-
cating which part of the date to return. The following table lists both the string
and enumeration choices.
dateValue (required; Date or date expression)
The date from which to extract a component.
firstDayOfWeekValue (optional; FirstDayOfWeek enumeration)
Indicates the first day of the week. One of the following Microsoft.VisualBasic.First-
DayOfWeek enumeration members:
Sunday, Monday, Tuesday, Wednesday, Thursday,
Friday, Saturday, or System (to use the regional default). If omitted, Sunday is used.
firstWeekOfYearValue (optional; FirstWeekOfYear enumeration)
Indicates which week counts as the first week of a given year. One of the
following Microsoft.VisualBasic.FirstWeekOfYear enumeration members.
String DateInterval Description
d Day
The day of the month, from 1 to 31
y DayOfYear
The day of the year, from 1 to 366
h Hour
The hour of the day, from 0 to 23
n Minute
The minute of the hour, from 0 to 59
m Month
The month of the year, from 1 to 12
q Quarter ...