Mysql date and time functions include: 1. [now()] gets the year, month, day, hour, minute and second; 2. [curdate()] gets the year, month, and day; 3. [dayofweek()] returns the date Week index; 4. [WEEKDAY()] returns the week index of date.
mysql date and time functions are:
1: In mysql, get the current time
1, now()
Get the year, month, day, hour, minute and second
curdate() Get the year, month and day
2: Get the day of the week that the current date belongs to in mysql
1,dayofweek ()<span style="font-family: monospace;"></span>Returns the week index of date (1=Sunday, 2=Monday, ……7=Saturday)
WEEKDAY()<span style="max-width:90%"></span>Returns the week index of date (0=Monday, 1=Tuesday, ……6=Sunday).
DAYOFMONTH()<span style="font-family: monospace;"></span>Returns the day of the month of date, in the range of 1 to 31.
DAYOFYEAR()<span style="max-width:90%"></span>Returns the number of days in a year, in the range of 1 to 366.
MONTH()<span style="max-width:90%"></span>Returns the month of date, ranging from 1 to 12.
DAYNAME()Returns the day of the week name of date.
MONTHNAME()<span style="max-width:90%"></span> Returns the month name of date.
QUARTER() Returns the quarter of the year in date, ranging from 1 to 4.
Related learning recommendations:
The above is the detailed content of What are the mysql date and time functions?. For more information, please follow other related articles on the PHP Chinese website!