How to make a change to dates by using functions and operators in Microsoft Access
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).
Date() function
The Date() function returns the current date in the short-date format.
Eg: 12/28/2006
Now() function
The Now() function returns the current date with the time.
Eg: 12/28/2006 04:46:50 PM
Format() function
use the Format() function with date values to specify the date format that you want to use for the date.
Eg: Format(Now() , “mmmm dd yyyy”)
The above example returns the current date in the format
December 28 2006
Day() function, WeekDay() function, Month() function, and Year() function
Eg: select Day(BirthDate) , WeekDay(BirthDate) , Month(BirthDate) , Year(BirthDate) from tblUser
The above query returns the day of birth, week of birth, month of birth and year of birth for each user from the table tblUsers. Note that the WeekDay() function returns a numeric value that indicates the day of the week.
DatePart() function
The DatePart() function can be used to extract the part of the specified date, such as the day, the month, or the year.
Eg: select DatePart(”yyyy”, BirthDate) from tblUsers
The above query returns the year component of the specified date.
DateDiff() function
The DateDiff() function returns the difference or the time lag between the two specified date values (in terms of the day, the month, the year, or the time units, such as hours, minutes, and seconds).
Eg: select DateDiff(”yyyy”, BirthDate, Date()) as Age from tblUsers
The above query returns the difference of years between the birthdate of the user and the current date.
DateAdd() function
The DateAdd() function increments a date by a specified number of time units, such as a day, a month, or a year and then returns the resultant value.
Eg: DateAdd(”yyyy”, 10, BirthDate)
The above example will add 10 years to the birthdate
DateValue() function
The DateValue() function verifies whether the input string is a valid date. If the input string is recognized as a valid date, the date is returned in short-date format. If the input string is not recognized as a valid date, the statement “Data type mismatch in criteria expression” is returned. The DateValue() function recognizes a variety of date formats, such as mm dd yyyy, dd mm yyyy, dd mmm yyyy, and dd mmm yyyy hh:mm:ss long date format.
Eg: SELECT DateValue(”28 Dec 2006″) AS ValidDate;
DateSerial() function
The DateSerial() function returns the date value for the specified input parameters of year, month, and day. The input parameters can be expressions that involve arithmetical operations. The DateSerial() function evaluates the expressions in the input parameters before it returns the resultant date value.
Eg: SELECT DateSerial( 2006, 05, 1-1);
This example query returns the last day in the month of April for the year 2006. The last input parameter for the day with the value of 1 is decremented by 1. The result is that the month parameter is evaluated to 4.
WeekdayName() function
Eg: SELECT WeekdayName(1, False, 1) AS FirstWeekDayName;
The WeekdayName() function returns a string that indicates the day of the week, as specified in the first parameter. The day of the week string that is returned depends on the third parameter. This parameter sets the first day of the week. The second parameter is set to False to specify that the weekday name must not be abbreviated.
MonthName() function
SELECT MonthName(1)
The MonthName() function returns a string that indicates the month name for the specified month number from 1 through 12. The input parameter can also be an expression, as in the following query:
Eg: SELECT MonthName( DatePart(”m”, Date()) );
This query returns the name of the current month.
Using Comparison Operators With Date Values
You can use the following comparison operators to compare date values in expressions and in queries:
<(less than)
>(greater than)
<=(less than or equal to)
>=(greater than or equal to)
<>(not equal)
SELECT * FROM tblUsers
WHERE BirthDate >= DateValue(” 10/01/1963″)
AND BirthDate <= DateValue(”12/31/1973″);
This query uses the >= comparison operator and the <= comparison operator to verify whether the birth date of the user falls in the range of the two specified dates.

July 10th, 2007 at 7:21 am
good day!!! will you please teach me the basics of microsoft access..
please.. thanks for your attention to this reply..
July 10th, 2007 at 8:02 am
Ms access is quite easy to pick up. There are plenty of tutorials available on the web. Do you have a specific query about Ms access ?