深入mysql YEAR() MONTH() DAYOFMONTH()日期函数的详解
2013-06-24 00:00
871 查看
mysql的日期函数. 例子中当前日期:
curdate() 是2013年6月24日。
YEAR() :显示年
mysql> select year(curdate()); +-----------------+ | year(curdate()) | +-----------------+ | 2013 | +-----------------+ 1 row in set (0.01 sec)
MONTH() :显示月
mysql> select month(curdate()); +------------------+ | month(curdate()) | +------------------+ | 6 | +------------------+ 1 row in set (0.00 sec)
DAYOFMONTH():显示日期
mysql> select dayofmonth(curdate()); +-----------------------+ | dayofmonth(curdate()) | +-----------------------+ | 24 | +-----------------------+ 1 row in set (0.08 sec)
curdate() 是2013年6月24日。
YEAR() :显示年
mysql> select year(curdate()); +-----------------+ | year(curdate()) | +-----------------+ | 2013 | +-----------------+ 1 row in set (0.01 sec)
MONTH() :显示月
mysql> select month(curdate()); +------------------+ | month(curdate()) | +------------------+ | 6 | +------------------+ 1 row in set (0.00 sec)
DAYOFMONTH():显示日期
mysql> select dayofmonth(curdate()); +-----------------------+ | dayofmonth(curdate()) | +-----------------------+ | 24 | +-----------------------+ 1 row in set (0.08 sec)
相关文章推荐
- 深入mysql YEAR() MONTH() DAYOFMONTH()日期函数的详解
- mysql 详解YEAR() MONTH() DAYOFMONTH()日期函数
- mysql 详解YEAR() MONTH() DAYOFMONTH()日期函数
- SQL 标量函数-----日期函数 day() 、month()、year()
- Linux crontab 的 day_of_month 和 day_of_week
- Sql Get Last Day of Month...
- Oracle 之 ORA-01847: day of month must be between 1 and last day of month
- SQL 标量函数-----日期函数 day() 、month()、year()
- ORA-01847: day of month must be between 1 and last day of month 解决方法
- Linux crontab 的 day_of_month 和 day_of_week
- Sql Get Last Day of Month...
- Linux crontab 的 day_of_month 和 day_of_week
- SQL 标量函数-----日期函数datediff()、 day() 、month()、year()
- Linux crontab 的 day_of_month 和 day_of_week
- oracle日期时间段查询遇到问题to_date ora-01847 day of month must be between 1 and last day of month
- Linux系统调用--gettimeofday/settimeofday函数详解
- Calendar.DAY_OF_MONTH存放什么数据
- 87.You want to display the date for the first Mon day of the next month and
- Linux crontab 的 day_of_month 和 day_of_week
- nowDate.add(Calendar.DAY_OF_MONTH,1); 谁能告诉我这里面的 1 是什么意思