mysql日期转时分秒

(UNIX_TIMESTAMP(ifnull(wf_hi_procrecord.end_time,now()))-UNIX_TIMESTAMP(wf_hi_procrecord.start_time))div 3600 as hour,
(UNIX_TIMESTAMP(ifnull(wf_hi_procrecord.end_time,now()))-UNIX_TIMESTAMP(wf_hi_procrecord.start_time))mod 3600 div 60 as min,
(UNIX_TIMESTAMP(ifnull(wf_hi_procrecord.end_time,now()))-UNIX_TIMESTAMP(wf_hi_procrecord.start_time))mod 60 as sec

UNIX_TIMESTAMP函数将日期转为秒。不过这个函数中的div可能在mycat路由的时候无法解析,不走mycat设置的分片。

你可能感兴趣的:(工作)