如何在单选查询中将float转换为时间戳 [英] how to convert float to timestamp in single select query
本文介绍了如何在单选查询中将float转换为时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
how to convert float to timestamp in single select query
for exp. i have float as 1.251152515236 ,
i want to convert this to datetime and from datetime to timestamp... i.e. 26:11:00
推荐答案
你的意思是秒格式即hh:mm:ss
尝试
You mean seconds to a Format i.e hh:mm:ss
try
SELECT
CONVERT(varchar, DATEADD(ms, 1.251152515236 * 1000, 0), 114)
ref。
http://stackoverflow.com/questions/1262497/how-to-convert-seconds-to-hhmmss-using-t-sql [ ^ ]
我找到答案
ie。
CONVERT(TIME(0),CONVERT(datetime,1.09796836411745)),
这给出了输出如02:21:04
I found answer
ie.
CONVERT(TIME(0),CONVERT(datetime,1.09796836411745)),
this gives output as 02:21:04
这篇关于如何在单选查询中将float转换为时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文