Retrieve the year component from the specified date.
SELECT DatePart(“yyyy”, #09/05/2017#); |
The DATEPART() function retrieves a specific part of a date as an integer value.
DatePart(datepart, date, firstdayofweek, firstweekofyear) |
Parameter |
Description |
datepart |
Mandatory. Specifies the unit of measurement for the difference to be returned. Options include:
|
date |
Required. The date from which a specific part will be extracted. |
firstdayofweek |
Optional. Specifies the first day of the week, which can be set to:
|
firstdayofyear |
Optional. Specifies the definition of the first week of the year, which can be set to:
|
WORKS IN |
From Access 2000 |
Retrieve the month component from the specified date.
SELECT DatePart(“m”, #09/05/2017#); |
Retrieve the weekday of the current date.
SELECT DatePart(“w”, Date()); |