MS Access DatePart() Function
Example
Return the year part of the specified date:
SELECT DatePart("yyyy", #09/05/2017#);
Try it Yourself »
Definition and Usage
The DatePart() function returns a specified part of a date, as an integer.
Syntax
DatePart(datepart, date, firstdayofweek,
firstweekofyear)
Parameter Values
Parameter | Description |
---|---|
datepart | Required. The date part to return. Can be one of the following values:
|
date | Required. The date value to be evaluated |
firstdayofweek | Optional. Specifies the first day of the week.
Can be one of the following values:
|
firstdayofyear | Optional. Specifies the first week of the year. Can be one of the following values:
|
Technical Details
Works in: | From Access 2000 |
---|
More Examples
Example
Return the month part of the specified date:
SELECT DatePart("m", #09/05/2017#);
Try it Yourself »
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.