Obtaining the Current Year, Month, Day, Hour, Minute, or Second
mysql>
mysql> SELECT CURDATE( ), YEAR(CURDATE( )) AS year,
-> MONTH(CURDATE( )) AS month, MONTHNAME(CURDATE( )) AS monthname,
-> DAYOFMONTH(CURDATE( )) AS day, DAYNAME(CURDATE( )) AS dayname;
+------------+------+-------+-----------+------+---------+
| CURDATE( ) | year | month | monthname | day | dayname |
+------------+------+-------+-----------+------+---------+
| 2011-10-03 | 2011 | 10 | October | 3 | Monday |
+------------+------+-------+-----------+------+---------+
1 row in set (0.00 sec)
mysql>
mysql>
Related examples in the same category