2016-08-23 138 views
0

我在HANA平台上有JIVE db。 JIVEUSER表追踪JIVE上所有用户的最新信息。 “lastloggedin”列是BIGINT数据类型。如何将bigint数据转换为可读日期格式

我想将“lastloggedin”列的值转换为可读的日期格式。

我创建了一个查询来将BIGINT转换为日期格式,它的工作原理。

SELECT ADD_SECONDS (TO_TIMESTAMP ('1970-01-01 00:00:00'), 1340961977) "add seconds" 
FROM DUMMY; 

1340961977 - 是BIGINT和输出值:2012年6月29日9:26:17.0 AM

但是,当我在我的表和字段运行相同的查询我得到一个错误。请从下面的查询和错误信息

查询:

SELECT ADD_SECONDS (TO_TIMESTAMP ('1970-01-01 00:00:00'), "lastloggedin") "add seconds" 
FROM "JIVE"."JIVEUSER" ; 

Error: [314]: numeric overflow: search table error: [6944] AttributeEngine: overflow in numeric calculation;longdate [here]add_seconds(longdate '1970-01-01 00:00:00.0000000', decfloat decfloat(fixed8_18 "lastloggedin")),lastloggedin = 1463427879839[fixed8_18.0]; checkNull false

任何人都可以请帮我这个错误?

我使用SAP HANA Studio版本:2.0.19

回答

0

lastloggedin似乎是一个Unix时间戳包括毫秒。

1463427879839 -> 2016-05-16 19:44:39.839 

尝试通过1000分,我不知道是否ADD_SECONDS作品的十进制值了。

-- this might work 
ADD_SECONDS (TO_TIMESTAMP ('1970-01-01 00:00:00'), "lastloggedin"/1000.000) 
-- or this 
ADD_SECONDS (TO_TIMESTAMP ('1970-01-01 00:00:00'), "lastloggedin"/1000) 
相关问题