1
2
3
4
5
UNIXEPOCH("dt",'utc','subsec')
82800
DATETIME("sec",'unixepoch','localtime')
1970-01-02 01:00:00
1
2
3
4
5
EXTRACT(EPOCH FROM "dt"::timestamp with time zone)
82800
TO_TIMESTAMP("sec"::bigint)::timestamp
1970-01-02 01:00:00
1
2
3
4
5
DATEDIFF(MILLISECOND,TIMESTAMP '1970-01-01 00:00:00',"dt") * 0.001
86400
SUBSTRING(CAST(DATEADD(SECOND,CAST("sec" AS BIGINT),TIMESTAMP '1970-01-01 00:00:00') AS VARCHAR(24)) FROM 1 FOR 19)
1970-01-02 00:00:00
1
2
3
4
5
EXTRACT(EPOCH FROM "dt")
86400
TIMESTAMP('1970-01-01 00:00:00',0) + "sec" SECONDS
1970-01-02 00:00:00
1
2
3
4
5
TRUNC(("dt" - date '1970-01-01') * 86400)
86400
TO_CHAR(TO_TIMESTAMP('19700101000000','YYYYMMDDHH24MISS')+NUMTODSINTERVAL("sec",'SECOND'),'YYYY-MM-DD HH24:MI:SS')
1970-01-02 00:00:00
2024-03-14T15:41:18 KuerbisEs geht darum, ob diese Funktionen die eingestellte Zeitzone berücksichtigen sollen oder nicht.
1
2
3
4
5
return "UNIXEPOCH($col,'utc','subsec')" if $with_timezone;
return "UNIXEPOCH($col,'subsec')";
...
return "DATETIME($col,'unixepoch','localtime')" if $with_timezone;
return "DATETIME($col,'unixepoch')";
1
2
3
UNIXEPOCH($col,'localtime','subsec') # 90000
DATETIME($col,'unixepoch','utc') # 1970-01-01 23:00:00
1
2
3
4
5
UNIXEPOCH("dt",'utc','subsec')
82800
DATETIME("sec",'unixepoch','localtime')
1970-01-02 01:00:00