1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > mysql时间函数总结_MySQL 日期时间函数常用总结

mysql时间函数总结_MySQL 日期时间函数常用总结

时间:2019-08-19 02:38:06

相关推荐

mysql时间函数总结_MySQL 日期时间函数常用总结

获得当前日期+时间(date+time)1.1函数:now()

相关函数:current_timestamp(),localtime(),localtimestamp()

举例说明:

2.获得当前日期(date)

函数:curdate()

相关函数:current_date(),current_date

举例说明:

3.获得当前时间(time)

函数:curtime()

相关函数:current_time(),current_time

举例说明

4.MySQLdayof…

函数:dayofweek(),dayofmonth(),dayofyear()分别返回日期参数,在一周、一月、一年中的位置。

举例说明

set@dt='-08-08';

selectdayofweek(@dt);--6

selectdayofmonth(@dt);--8

selectdayofyear(@dt);--221

日期‘-08-08′是一周中的第6天(1=Sunday,2=Monday,…,7=Saturday)

一月中的第8天;一年中的第221天

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。