github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/function/func_to_seconds.sql (about)

     1  select TO_SECONDS(null);
     2  SELECT TO_SECONDS('19950501');
     3  SELECT TO_SECONDS('2007-10-07');
     4  SELECT TO_SECONDS('2008-10-07');
     5  SELECT TO_SECONDS('0001-01-01');
     6  
     7  drop table if exists t_dates;
     8  create table t_dates(
     9  a_date date,
    10  b_datetime datetime,
    11  c_timestamp timestamp
    12  );
    13  
    14  insert into t_dates values('1999-04-05', '1999-04-05 11:01:02', '1999-04-05 11:01:02');
    15  insert into t_dates values('2004-04-03', '2004-04-03 13:11:10', '2004-04-03 13:11:10');
    16  insert into t_dates values('2012-04-05', '2012-04-05 11:01:02', '2012-04-05 11:01:02.123456');
    17  insert into t_dates values('1997-04-03', '1997-04-03 13:11:10', '1997-04-03 13:11:10.123456');
    18  insert into t_dates values('2022-04-05', '2022-04-05 11:01:02.123456', '2022-04-05 11:01:02.123456');
    19  insert into t_dates values('1999-09-05', '2004-09-03 13:11:10.123456', '2004-09-03 13:11:10.123456');
    20  insert into t_dates values(null, null, null);
    21  insert into t_dates values('', '', '');
    22  
    23  select a_date, TO_SECONDS(a_date) from t_dates order by a_date;
    24  select * from t_dates where TO_SECONDS(a_date) > 730214;
    25  
    26  select b_datetime, TO_SECONDS(b_datetime) from t_dates order by b_datetime;
    27  select * from t_dates where TO_SECONDS(b_datetime) > 730214;
    28  
    29  drop table t_dates;