select extract(timezone from timestamp with time zone '2001-02-16 20:38:40.12-08'); Result: 28800
select extract(timezone_hour from timestamp with time zone '2001-02-16 20:38:40.12-08'); Result: 8
select extract(timezone_minute from timestamp with time zone '2001-02-16 20:38:40.12-08'); Result:0
select extract(century from timestamp '2000-12-16 12:21:13'); Result: 20 select extract(century from timestamp '2001-02-16 20:38:40'); Result: 21
select extract(year from timestamp '2001-02-16 20:38:40'); Result: 2001
select extract(quarter from timestamp '2001-02-16 20:38:40'); Result: 1
获取 timestamp 的月数(1-12) & interval 的月数对12取模(0-11)@H_301_2@
select extract(month from timestamp '2001-02-16 20:38:40'); Result: 2 select extract(month from interval '2 years 3 months'); Result: 3 select extract(month from interval '2 years 13 months'); Result: 1
select extract(week from timestamp '2001-02-16 20:38:40'); Result: 7
获取 timestamp 的天数(1-31) & interval 的总天数@H_301_2@
select extract (day from timestamp '2001-02-16 20:38:40'); Result: 16 select extract(day from interval '40 days 1 minute'); Result: 40
获取 timestamp 的天数(Sunday(0) - Saturday(6))@H_301_2@
select extract(dow from timestamp '2001-02-16 20:38:40'); Result: 5
获取 timestamp 的天数(Monday(1) - Sunday(7))@H_301_2@
select extract(isodow from timestamp '2001-02-18 20:38:40'); Result: 7
获取 timestamp 的天数(1-365/366)@H_301_2@
select extract(doy from timestamp '2001-02-16 20:38:40'); Result: 47
select extract(hour from timestamp '2001-02-16 20:38:40'); Result: 20
select extract(minute from timestamp '2001-02-16 20:38:40'); Result: 38
select extract(second from timestamp '2001-02-16 20:38:40'); Result: 40 select extract(second from time '17:12:28.5'); Result: 28.5
获取总秒数(对于 timestamp 从 1970-01-01 00:00:00 UTC 开始计算)@H_301_2@
select extract(epoch from timestamp with time zone '2001-02-16 20:38:40.12-08'); Result: 982384720.12 select extract(epoch from interval '5 days 3 hours'); Result: 442800