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
CodePudding user response:
Try this
select dateadd (ms,duration,'1900-01-01 00:00:00.000') FROM Event ...,
CodePudding user response:
The CONVERT syntax is:
CONVERT(value, type)
So do this:
..., SELECT CONVERT(duration, datetime) FROM Event ...,