The syntax for this function is:
DatePart(datepart,date)
The datepart argument is the abbreviation for the part of the date you want returned. Examples are "yyyy" for a four-digit year and "q" for a calendar quarter. The date argument is either a field name with the Date/Time data type or a literal date such as "7-Nov-93".
The following table lists examples of expressions that apply the DatePart function to the OrderDate field from the Orders table.
If the value in OrderDate is |
This expression |
Returns |
---|---|---|
3-Jun-93 | DatePart("m",[OrderDate]) | 6 (month of year) |
28-Mar-92 | DatePart("yyyy",[OrderDate]) | 1992 (four-digit number of year) |