FROM_POSIX_TIME

Purpose

Posix time (also known as Unix time) is a system for describing points in time, defined as the number of seconds elapsed since midnight of January 1, 1970 (UTC). By using this function you can convert the Posix Time (that means a numerical value) to a timestamp.

Syntax

from_posix_time::=

Usage Notes

  • FROM_POSIX_TIME(<number>) is equivalent to the function call ADD_SECONDS('1970-01-01 00:00:00',<number>), if the session time zone is set to UTC.
  • If you pass a negative number, the function will return timestamps before January 1, 1970 (UTC).
  • Using the function POSIX_TIME you can compute the Posix time, that means you can convert a datetime value into a numeric value.

Example

ALTER SESSION SET TIME_ZONE='UTC';
SELECT FROM_POSIX_TIME(1) FPT1,
       FROM_POSIX_TIME(1234567890) FPT2;
Result
FPT1 FPT2
1970-01-01 00:00:01.000000 2009-02-13 23:31:30.000000