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. MySQL dayof…
函数:dayofweek(), dayofmonth(), dayofyear()分别返回日期参数,在一周、一月、一年中的位置。
举例说明
set @dt = '2008-08-08';
select dayofweek(@dt); -- 6
select dayofmonth(@dt); -- 8
select dayofyear(@dt); -- 221
日期‘2008-08-08′ 是一周中的第6 天(1 = Sunday, 2 = Monday, …, 7 = Saturday)
一月中的第8 天;一年中的第221 天
相关文章
PHP5.5.15+Apache2.4.10+MySQL5.6.20配置方法分享
这篇文章主要为大家详细介绍了PHP5.5.15、Apache2.4.10和MySQL5.6.20配置方法,感兴趣的小伙伴们可以参考一下2016-05-05
PHP基于闭包思想实现的BT(torrent)文件解析工具实例详解
这篇文章主要介绍了PHP基于闭包思想实现的BT(torrent)文件解析工具,结合具体实例形式分析了php针对torrent文件的读取与解析相关操作技巧,需要的朋友可以参考下2017-08-08


最新评论