如果17420值给出日期,那么该值17420.424097将给出什么日期时间 [英] If 17420 value gives the date, then what date time will be given by this value 17420.424097

查看:72
本文介绍了如果17420值给出日期,那么该值17420.424097将给出什么日期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有将字符串'17420'转换为日期的函数,当我得到像'17420.424097'这样的值代替时,我应该能够得到日期和时间。请告诉我如何继续....

we have function which converts the string '17420' to date and when i get a value like '17420.424097' in place of that, i should be able to get date and time. pls let me know how to proceed....

推荐答案

与日期相同。取小数点后面的数字,很可能是午夜过后的毫秒。
The same way you do with the date. Take the number after the decimal point, it is most likely milliseconds past midnight.


这个值看起来像一个浮点值的Excel日期/时间编码。

整数部分是自参考日期以来的日期数。

小数部分将时间编码为一天的一部分。

一天编码为1。

1天是24小时,1小时是1/24或0.0417 ...

等等。



0.424097约为10:10:42



其他编码也是可能的。
This value look like an Excel date/time encoding in a floating point value.
The integer part is a day number since a reference date.
the fractional part is encoding the time as a part of a day.
A day is encoded as 1.
1 day is 24 hours, 1 hour is 1/24 or 0.0417...
an so on.

0.424097 is about 10:10:42

Other encoding are also possible.


DECLARE @UTC BIGINT
SET @UTC = 17420.424097

SELECT DATEADD(MILLISECOND, @UTC % 1000, DATEADD(SECOND, @UTC / 1000, '19000101'))


这篇关于如果17420值给出日期,那么该值17420.424097将给出什么日期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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