返回当前时间戳的函数
select current_timestamp,clock_timestamp();
返回当前时间戳函数不带时区
select current_timestamp::timestamp without time zone,clock_timestamp()::timestamp without time zone;
将当前时间转换为自1970-01-01开始到当前的整数
select extract(epoch from now());
如果将时间戳转换为整型,带有时区和不带有时区的值是不一样的。
select extract(epoch from now()),extract(epoch from now()::timestamp without time zone);
输出时间不带精度
select current_timestamp(0),current_time(0),localtime(0),localtimestamp(0);
将输出不带精度的时间转换为整数
select extract(epoch from current_timestamp(0)) ;
.将epoch整数转换为时间
select to_timestamp(1634200047);
将时间按照时间域进行分解,有两个函数可以实现,一个是extract函数,一个是date_part函数
select date_part('month',now()),extract('month' from now());
间隔函数 interval
select now() + interval'3 minute' ;
间隔天数换算
days_between:
create extension kdb_date_function;
select days_between(systimestamp,to_date('20220407101023','yyyymmddhh24miss'))*24*60;
oracle.subtract
create extension kdb_orafce ;
select oracle.subtract(now(), to_date('20220407101523','yyyymmddhh24miss'));




