如何在转换数值时显示确切的时间 [英] How to show exact time when convert numeric value
本文介绍了如何在转换数值时显示确切的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
SELECT TOP (200) Emp_ID, ProxyNo, EmpName, JoiningDate, Dept_Name, Designation, Emp_Type, Atten_date, OriginIntime, EIntime, EOutTime, Status, Shift, Overtime, OutTimeCal, TotOT, RealOT, EOT, MorOT,
TimeDedu, SDate, EDate, PDay, AbDay, CLDay, ELDay, SLDay, WDay, FDay, WorkHrs, Pstatus, Section, Unit_Name, SubSection, ComID
FROM Temp_JobCard
WHERE (RealOT = 1.50)
这里我要显示1.5 = 01 :30表示,如果结果是1.5,它将显示01:30。同样为1.25 = 01:15。基本上我需要显示时间,小时来转换这个数字。
我尝试过:
Here I want to show 1.5 = 01:30 that means, if the result is 1.5 it will show me 01:30 .Same as 1.25= 01:15. Basically i need to show time,hour to convert this numeric number.
What I have tried:
SELECT CONVERT(datetime,REPLACE('1.5','.',':'))
我的输出是
My output is
1900-01-01 01:05:00.000
但它不正确。
但是我需要的输出是
But its not correct.
But I need output is
01:30<pre>
推荐答案
一个简单的谷歌会有找到你了:它帮了我。
在sql中将float转换为小时和分钟 - Google搜索 [ ^ ]
顶部链接(以及所有其他198,000个链接)将为您提供解决方案: sql server - SQL:浮点数到小时格式 - 堆栈溢出 [ ^ ]
将来请尝试自己做至少基础研究,而不是浪费你的时间或我们的时间。
A simple google would have found you this: it did me.
convert float to hours and minutes in sql - Google Search[^]
The top link (and all the other 198,000 links) will give you a solution: sql server - SQL: float number to hours format - Stack Overflow[^]
In future, please try to do at least basic research yourself, and not waste your time or ours.
这篇关于如何在转换数值时显示确切的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文