teradata SQL 将实数转换为时间戳

teradata SQL convert real to timestamp

我不明白如何将这种类型的实数 - 42389.520752314813 转换为时间戳。

我从一个来源获得了这些数据,但我需要将其转换为正常的时间戳格式。

我认为您收到了错误的输入数据。

此类时间戳仅在目标工具为 excel 且 CELL 为 "Number" 类型时出现,并且在时间戳的复制粘贴期间,目标字段将其计算为 数学函数。请重新验证您的来源。我确信这个数学计算。请检查以下此类数据示例。 So practically you cannot perform its reverse operation.


不知道应该返回什么时间戳很难做到。

如果日期来自 SQL 服务器,则它可能是“2016-01-22 12:29:53”:

cast( date '1900-01-01' + myCol as timestamp(3)) 
+ (cast(86400 * (myCol mod 1) as dec(12,6)) * interval '00:00:01.000000' hour to second)

如果来自 Excel 则提前两天,您必须从“1899-12-30”开始