且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将整数转换为时间

更新时间:2023-02-03 16:45:22

为什么不能使用ADDTIME函数?



  SELECT  ADDTIME(''  01:00:00''  01:30 :00' AS  Extra_OT 


hallo everyone,
i have trouble during convert integer become time in mysql.
1.i have 2 rows of data in time format.
row A=01:00:00
row B=01:30:00
after that i convert this two data become integer data type and i add row A and B data.
after i get the result from this two row where the result is 150. i try to convert it back become time data type, but i m stuck in this part. any suggestion from senior are appreciate
thank you very much

anywhere this is my sql Query

SELECT SUM((MID(Total,1,2) * 60) + MID(Total,4,2)) AS Extra_OT FROM extra_overtime WHERE Emp_ID='001EJ011' AND DATE(AttDate)='2013-10-03' GROUP BY Emp_ID, AttDate;

Why can't you use the ADDTIME function?

SELECT ADDTIME('01:00:00','01:30:00') AS Extra_OT