在oracle中将unix_timestamp转换为时间戳
问题描述:
如何在oracle中将unix_timestamp转换为时间戳?
How to convert unix_timestamp to timestamp in oracle?
我使用了以下功能,但是没有用. "UNIX_TIMESTAMP(event_time_stamp)"
I used the below function but it didn't work. "UNIX_TIMESTAMP(event_time_stamp)"
这是完整的查询:
答
UNIX时间戳表示自1970年1月1日以来经过的秒数.Oracle允许直接在时间戳中添加一些天数.我们可以通过将UNIX时间戳值中的适当天数添加到1970-01-01 00:00:00
:
The UNIX timestamp represents the number of seconds which have elapsed since January 1, 1970. Oracle allows adding some number of days directly to a timestamp. We can build the timestamp you want by adding the appropriate number of days in your UNIX timestamp value to 1970-01-01 00:00:00
:
SELECT
TIMESTAMP '1970-01-01 00:00:00' + NUMTODSINTERVAL(1511421211, 'second')
FROM dual;
这将返回以下内容:
23.11.2017 07:13:31