By : Dhirendra Chauahn
MySQL
Date Functions
Date and Time Function
1. CURDATE() / CURRENT_DATE()
2. NOW()
3. SYSDATE()
4. DATE()
5. MONTH()
6. YEAR()
7. DAYNAME()
8. DAYOFWEEK()
9. DAYOFYEAR()
10.DAYOFMONTH()
CURDATE()
“this function returns the current date of system”
Syntax /Example:
Select CURDATE();
OUTPUT
NOW()
“this function returns the time at which the function executes”
Syntax /Example:
Select NOW();
OUTPUT
SYSDATE()
“this function returns the current date and time”
Syntax /Example:
Select SYSDATE();
OUTPUT
DATE()
“this function extracts the date part of a date or
date –time expression”
Syntax /Example:
Select DATE(“2020-12-31 01:02:03”);
OUTPUT
MONTH()
“this function returns the month from the date passed”
Syntax /Example:
Select MONTH(“2020-03-31”);
OUTPUT
YEAR()
“this function returns the year”
Syntax /Example:
Select YEAR(“2020-03-31”);
OUTPUT
DAYNAME()
“this function returns the name of the weekday”
Syntax /Example:
Select DAYNAME(“2020-10-08”);
OUTPUT
DAYOFWEEK()
“this function returns the weekday index of the argument”
Syntax /Example:
Select DAYOFWEEK(“2020-10-08”);
OUTPUT
DAYOFYEAR()
“this function returns the day of year (1 - 366)”
Syntax /Example:
Select DAYOFYEAR(“2020-10-08”);
OUTPUT
DAYOFMONTH()
“this function returns the day of month(1-31)”
Syntax /Example:
Select DAYOFMONTH(“2020-10-08”);
OUTPUT
THANK
YOU

V33 date function-c