github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/function/func_datetime_datediff.test (about) 1 SELECT DATEDIFF('2017-08-17','2017-08-17'); 2 SELECT DATEDIFF('2017-08-17','2017-08-08'); 3 SELECT DATEDIFF('2017-08-08','2017-08-17'); 4 5 SELECT DATEDIFF(NULL,'2017-08-17'); 6 SELECT DATEDIFF('2017-08-17',NULL); 7 SELECT DATEDIFF(NULL, NULL); 8 9 drop table if exists t1; 10 create table t1(a INT, b date); 11 insert into t1 values(1, "2012-10-11"); 12 insert into t1 values(2, "2004-04-24"); 13 insert into t1 values(3, "2008-12-04"); 14 insert into t1 values(4, "2012-03-23"); 15 insert into t1 values(5, "2000-03-23"); 16 insert into t1 values(6, "2030-03-23"); 17 insert into t1 values(7, "2040-03-23"); 18 SELECT a, DATEDIFF('2022-10-9', b) from t1; 19 drop table t1; 20 21 drop table if exists t1; 22 create table t1(a INT, b date); 23 insert into t1 values(1, "2012-10-11"); 24 insert into t1 values(2, "2004-04-24"); 25 insert into t1 values(3, "2008-12-04"); 26 insert into t1 values(4, "2012-03-23"); 27 insert into t1 values(5, "2000-03-23"); 28 insert into t1 values(6, "2030-03-23"); 29 insert into t1 values(7, "2040-03-23"); 30 SELECT a, DATEDIFF(b, '2022-10-9') from t1; 31 drop table t1; 32 33 drop table if exists t1; 34 create table t1(a date, b date); 35 insert into t1 values('2022-10-9', "2012-10-11"); 36 insert into t1 values('2022-10-9', "2004-04-24"); 37 insert into t1 values('2022-10-9', "2008-12-04"); 38 insert into t1 values('2022-10-9', "2012-03-23"); 39 insert into t1 values('2022-10-9', "2000-03-23"); 40 insert into t1 values('2022-10-9', "2030-03-23"); 41 insert into t1 values('2022-10-9', "2040-03-23"); 42 SELECT a, b, DATEDIFF(a, b) from t1; 43 drop table t1; 44 45