Date() and DateAdd() Function in MS Access
1. Date() Function :
Date() function returns the current date of the system. In this function, no parameter will be passed and it will return the current date.
Syntax :
Date()
Example :
SELECT Date() AS CurrentDate;
Output –
CurrentDate |
---|
9/2/2020 |
2. DateAdd() Function :
DateAdd() function will add the time interval and date to the given date and return it. In this function, the first parameter will be the interval notation and second parameter will be the number that will be added and the third parameter will be the date,
Interval | Description |
---|---|
yyyy | Year |
q | Quarter |
m | month |
y | Day of the year |
d | Day |
w | Weekday |
ww | Week |
h | hour |
n | Minute |
s | Second |
Syntax :
DateAdd(interval, number, date)
Example-1 :
SELECT DateAdd("yyyy", 3, #02/09/2020#);
Output –
Output : |
---|
2/9/2023 |
Example-2 :
SELECT DateAdd("m", 3, Date()) As Date;
Output –
Output : |
---|
12/2/2020 |
Contact Us