mysql 時間函式date format

2021-09-06 19:27:10 字數 463 閱讀 4531

今天,在開發郵件系統的時候發現有很多的郵件沒有傳送成功,想手動把資料修改。找了mysql 的日期函式

獲得的pubtime為string型,在sql語句中用mysql的時間函式date_format('time','format')轉換:

string sqlstr="select * from do_document where

pub_time然後執行該sql語句就查到了滿足條件的記錄。

用法:select count(*)  from message where date_format(sendtime,'%y-%m-%d') = '2010-11-16'  

select count(*) from test_table where  activityid in (-1,4)  and weibotime < str_to_date('2011-09-01 00:00:00', '%y-%m-%d %h:%i:%s')

mysql時間函式

這些函式都是mysql自帶的,可以直接使用在php寫的mysql查詢語句中哦 1 curdate 或current date 和curtime 或current time 這兩個函式是比較常用到的,顧名思義,第乙個返回當前日期,第二個返回當前時間 可以在mysql客戶端或者php語句裡寫 selec...

mysql時間函式

unix timestamp unix timestamp date 若無引數呼叫,則返回乙個unix timestamp 1970 01 01 00 00 00 gmt 之後的秒數 作為無符號整數。若用date 來呼叫unix timestamp 它會將引數值以 1970 01 01 00 00 ...

MySQL時間函式

dayofweek date 返回日期date是星期幾 1 星期天,2 星期一,7 星期六,odbc標準 mysql select dayofweek 1998 02 03 3 weekday date 返回日期date是星期幾 0 星期一,1 星期二,6 星期天 mysql select week...