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

     1  select to_days(null);
     2  to_days(null)
     3  null
     4  SELECT TO_DAYS('19950501');
     5  to_days(19950501)
     6  728779
     7  SELECT TO_DAYS('2007-10-07');
     8  to_days(2007-10-07)
     9  733321
    10  SELECT TO_DAYS('2008-10-07');
    11  to_days(2008-10-07)
    12  733687
    13  SELECT TO_DAYS('0001-01-01');
    14  to_days(0001-01-01)
    15  366
    16  drop table if exists t_dates;
    17  create table t_dates(
    18  a_date date,
    19  b_datetime datetime,
    20  c_timestamp timestamp
    21  );
    22  insert into t_dates values('1999-04-05', '1999-04-05 11:01:02', '1999-04-05 11:01:02');
    23  insert into t_dates values('2004-04-03', '2004-04-03 13:11:10', '2004-04-03 13:11:10');
    24  insert into t_dates values('2012-04-05', '2012-04-05 11:01:02', '2012-04-05 11:01:02.123456');
    25  insert into t_dates values('1997-04-03', '1997-04-03 13:11:10', '1997-04-03 13:11:10.123456');
    26  insert into t_dates values('2022-04-05', '2022-04-05 11:01:02.123456', '2022-04-05 11:01:02.123456');
    27  insert into t_dates values('1999-09-05', '2004-09-03 13:11:10.123456', '2004-09-03 13:11:10.123456');
    28  insert into t_dates values(null, null, null);
    29  insert into t_dates values('', '', '');
    30  select a_date, to_days(a_date) from t_dates order by a_date;
    31  a_date    to_days(a_date)
    32  null    null
    33  null    null
    34  1997-04-03    729482
    35  1999-04-05    730214
    36  1999-09-05    730367
    37  2004-04-03    732039
    38  2012-04-05    734963
    39  2022-04-05    738615
    40  select * from t_dates where to_days(a_date) > 730214;
    41  a_date    b_datetime    c_timestamp
    42  2004-04-03    2004-04-03 13:11:10    2004-04-03 13:11:10
    43  2012-04-05    2012-04-05 11:01:02    2012-04-05 11:01:02
    44  2022-04-05    2022-04-05 11:01:02    2022-04-05 11:01:02
    45  1999-09-05    2004-09-03 13:11:10    2004-09-03 13:11:10
    46  select b_datetime, to_days(b_datetime) from t_dates order by b_datetime;
    47  b_datetime    to_days(b_datetime)
    48  null    null
    49  null    null
    50  1997-04-03 13:11:10    729482
    51  1999-04-05 11:01:02    730214
    52  2004-04-03 13:11:10    732039
    53  2004-09-03 13:11:10    732192
    54  2012-04-05 11:01:02    734963
    55  2022-04-05 11:01:02    738615
    56  select * from t_dates where to_days(b_datetime) > 730214;
    57  a_date    b_datetime    c_timestamp
    58  2004-04-03    2004-04-03 13:11:10    2004-04-03 13:11:10
    59  2012-04-05    2012-04-05 11:01:02    2012-04-05 11:01:02
    60  2022-04-05    2022-04-05 11:01:02    2022-04-05 11:01:02
    61  1999-09-05    2004-09-03 13:11:10    2004-09-03 13:11:10
    62  drop table t_dates;