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

     1  -- convert_tz timezone name
     2  select convert_tz('2023-11-06 10:28:00','GMT', 'MET') as dtime;
     3  select convert_tz('1999-06-06 10:28:00','MET','Europe/Moscow') as dtime;
     4  select convert_tz('2020-05-09 10:28:00','Japan', 'Mexico/BajaNorte') as dtime;
     5  select convert_tz('2023-08-06 10:28:00','MET','Europe/Moscow') as dtime;
     6  select convert_tz('2007-09-11 02:00:00','America/Cambridge_Bay','GMT-0')as dtime;
     7  select convert_tz('2000-10-06 10:28:00','GMT', 'UTC') as dtime;
     8  select convert_tz('2003-12-06 10:28:00','CET','EST') as dtime;
     9  select convert_tz('2023-12-31 10:28:00','+08:00', 'America/New_York') as dtime;
    10  select convert_tz('2023-02-06 10:28:00','MET','Hongkong') as dtime;
    11  select convert_tz('2023-03-11 02:00:00','Asia/Shanghai','+05:00')as dtime;
    12  -- select convert_tz('2007-03-11 02:00:00','US/Eastern','US/Central')as dtime;
    13  select convert_tz('2023-11-05 05:00:00','US/Eastern','US/Central')as dtime;
    14  
    15  -- convert_tz timezone
    16  select convert_tz('2023-01-06 10:28:00','+08:00', '+10:00') as dtime;
    17  select convert_tz('2023-02-06 10:28:00','+08:00', '+00:00') as dtime;
    18  select convert_tz('2023-03-06 10:28:00','+08:00', '+05:00') as dtime;
    19  select convert_tz('2023-04-26 10:28:00','+05:00', '+08:00') as dtime;
    20  select convert_tz('2023-05-16 10:28:00','+00:00', '+08:00') as dtime;
    21  select convert_tz('2023-06-01 10:28:00','+00:00', '+23:00') as dtime;
    22  select convert_tz('2023-07-06 10:28:00','+06:00', '+12:00') as dtime;
    23  select convert_tz('2023-08-30 10:28:00','+12:00', '+06:00') as dtime;
    24  select convert_tz('2020-09-19 19:59:00','+00:00', '+05:30') as dtime;
    25  select convert_tz('2020-10-19 19:59:00','-05:00', '+05:30') as dtime;
    26  select convert_tz('2010-11-01 12:00:00','+00:00','-07:00') as dtime;
    27  select convert_tz('2010-12-30','+00:00','-07:00') as dtime;
    28  
    29  -- null
    30  select convert_tz(NULL,'-05:00', '+05:30') as dtime;
    31  select convert_tz('2023-11-06 10:28:00',NULL, '+08:00') as dtime;
    32  select convert_tz('2023-11-06 10:28:00','+00:00', NULL) as dtime;
    33  
    34  -- out of time range
    35  select convert_tz('9999-12-31 23:59:59','+08:00', '+12:30') as dtime;
    36  select convert_tz('0001-01-01 00:00:01','+00:00', '-5:30') as dtime;
    37  -- invalid parameter
    38  select convert_tz('2023-11-06 10:28:00','+00:00', '11111') as dtime;
    39  select convert_tz('2023-11-06 10:28:00','+00:aa', '+08:00') as dtime;
    40  select convert_tz('2023-11','+00:00', '+08:00') as dtime;
    41  -- datetime,timestamp,date type
    42  create table convert_table(c1 datetime,c2 date,c3 timestamp(3));
    43  insert into convert_table values('2010-09-26','2022-01-02 10:02:00','2021-05-02 12:02:00.0923'),('2011-02-20 10:02:00','2020-01-02','2021-05-02'),('2019-03-16 11:12:00','2022-01-02 10:02:00','2021-05-02 12:02:00.0923');
    44  select convert_tz(c1,'+00:00', '+08:00'),c1 from convert_table;
    45  select convert_tz(c2,'+00:00', '+08:00'),c2 from convert_table;
    46  select convert_tz(c3,'+00:00', '+08:00'),c3 from convert_table;
    47  
    48  --date function
    49  select convert_tz(str_to_date('2022-05-27 11:30:00','%Y-%m-%d %H:%i:%s'),'-05:00', '+05:30')as dtime;