将整数转换为时间 [英] convert integer to time

查看:564
本文介绍了将整数转换为时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

i在转换整数时遇到麻烦成为mysql中的时间。

1.i有时间格式的2行数据。

行A = 01:00:00

行B = 01:30:00

之后我将这两个数据转换为整数数据类型并添加行A和B数据。

我从这两行获得结果后结果为150.我尝试将其转换回时间数据类型,但我陷入了这一部分。任何来自大四的建议都表示赞赏

非常感谢



这是我的SQL查询



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

解决方案

为什么不能使用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


这篇关于将整数转换为时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆