Open In App

DateSerial() and DateValue() Function in MS Access

Last Updated : 25 Sep, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we are going to cover DateSerial() and DateValue() Function in MS Access with examples and will cover DateSerial and DateValue query with output.

DateSerial() Function :
The format of the DateSerial functions contains three parts year, month, and day values. And it returns date in a specified format. There are three parameters first one is year second one is month and the third one is the day.

Syntax :

DateSerial(year, month, day)

Parameter Values :

Parameter Description
year It is required. It will specify a year of 4 digits.
month It is required. It will specify a month of 2 digits.
day It is required. It will specify a day of 2 digits.

Example-1 :

SELECT DateSerial(2020-10, 10-1, 20-5);

Output :

9/15/2010 

Example-2 :

SELECT DateSerial(2020, 4, 20);

Output :

4/20/2020 

DateValue() Function :
In MS Access, DateValue() function returns a date based on a string.In this function, a string that contains day, month, and year will be passed and it will return the date based on the string.

Note :
If the year part of the string is not given then it will take the current year.

Syntax :

DateValue(string_date)

Parameter Values :

Parameter Description
string_date It is required. It will represents a date from rom January 1, 100 to December 31, 9999.

Example-1 :

SELECT DateValue("May 12, 2010");

Output :

5/12/2010

Example-2 :

SELECT DateValue("July 10");

Output :

7/10/2020 

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads