"update tb_cur_warning set isrecovered = 1,recovered_kind = " "%d,recovered_time"
"= to_date('%02d%02d%02d%02d %02d:%02d:%02d','yyyymmdd hh24:mi:ss') where " //for oracle
"ssid = %d and stationid = %d and macid = %d and slotid = %d "
"and warncode = %d and isrecovered = 0"
求救:上面这段oracle的语句改成mysql的怎么改啊,mysql的to_date用什么函数
"= to_date('%02d%02d%02d%02d %02d:%02d:%02d','yyyymmdd hh24:mi:ss') where " //for oracle
"ssid = %d and stationid = %d and macid = %d and slotid = %d "
"and warncode = %d and isrecovered = 0"
求救:上面这段oracle的语句改成mysql的怎么改啊,mysql的to_date用什么函数
实例1: select if (str_to_date(column1, '%m/%d/%Y %r') is null,
if (str_to_date(column1, '%Y-%m-%d') is null,
str_to_date(column1,
'%c/%e/%Y %T'), str_to_date(column1, '%Y-%m-%d')),
str_to_date(column1,
'%m/%d/%Y %r')) as a from t 实例2: select
DATE_FORMAT(STR_TO_DATE(REPLACE (REPLACE (Date, 'AM', ''), 'PM', ''),
'%c/%e/%Y %k:%i:%s %p'), '%Y-%m-%d') as Date as b from t本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/wslyy99/archive/2008/11/09/3260117.aspx
用 DATE_FORMAT 来实现你的功能。
updatesql.printf("update tb_cur_warning set isrecovered = 1,recovered_kind = "
"%d,recovered_time
"= to_date('%02d%02d%02d%02d %02d:%02d:%02d','yyyymmdd hh24:mi:ss') where "
"ssid = %d and stationid = %d and macid = %d and slotid = %d "
"and warncode = %d and isrecovered = 0",
warning->WType, warning->theTime.StrYear.hiYear,
warning->theTime.StrYear.loYear,
warning->theTime.ucMon, warning->theTime.ucDay,
warning->theTime.ucHour, warning->theTime.ucMin,
warning->theTime.ucSec, (int)
warning->ssid,warning->stationid, warning->macid,
warning->slotid, warning->warncode +RecoverIDBase);