mysql时间函数总结_MySQL 日期时间函数常用总结
獲得當(dāng)前日期+時(shí)間(date?+?time)1.1????函數(shù):now()
相關(guān)函數(shù):current_timestamp(),localtime(),localtimestamp()
舉例說明:
2.?獲得當(dāng)前日期(date)
函數(shù):curdate()
相關(guān)函數(shù):current_date(),current_date
舉例說明:
3.?獲得當(dāng)前時(shí)間(time)
函數(shù):curtime()
相關(guān)函數(shù):current_time(),current_time
舉例說明
4.?MySQL?dayof…
函數(shù):dayofweek(),?dayofmonth(),?dayofyear()分別返回日期參數(shù),在一周、一月、一年中的位置。
舉例說明
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?天
總結(jié)
以上是生活随笔為你收集整理的mysql时间函数总结_MySQL 日期时间函数常用总结的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 楚乔传乌先生真实身份曝光 乌道涯最后结局
- 下一篇: mysql动态sql是什么,mysql中