简体   繁体   中英

How to convert Millisecond to date and time using mysql

I have a record on the database duration field = "3600000", i just want to convert that into date and time, how do i do that?

I've tried this

..., SELECT GETDATE(duration) FROM Event ....,

and this

 ..., SELECT CONVERT(datetime, duration, 101) FROM Event ...,

and this

..., SELECT CONVERT(datetime, duration, ISO) FROM Event ...,

and this

..., SELECT CONVERT(datetime, duration) FROM Event ...,

ive always get ERROR on QUERY

reference https://www.w3schools.com/sql/func_mysql_convert.asp

Try this

select dateadd (ms,duration,'1900-01-01 00:00:00.000') FROM Event ...,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM