1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
/* test date and time support */
\set format unaligned
set icu_ext.locale to 'en@calendar=gregorian';
set icu_ext.timestamptz_format to 'YYYY-MM-dd HH:mm:ss';
set timezone to 'Europe/Paris';
-- DST transition to summer time
select
'2023-03-25 00:00:00'::timestamptz + '26.5 hours'::interval AS "core",
'2023-03-25 00:00:00'::icu_timestamptz + '26.5 hours'::icu_interval AS "ext";
core | ext
-------------------------------+---------------------
Sun Mar 26 03:30:00 2023 CEST | 2023-03-26 03:30:00
(1 row)
set icu_ext.locale to 'en@calendar=ethiopic';
-- Use explicit formats to minimize compat problems
-- For instance, {short} had varied across ICU versions:
-- before ICU v72, the separator between hour and AM/PM designator
-- is an ASCII space, whereas since v72 it is NARROW NO-BREAK SPACE (U+202F)
-- In ICU v78, the era names for the ethiopic calendar also change
set icu_ext.date_format to 'M/d/y';
set icu_ext.timestamptz_format to 'M/d/y, hh:mm a';
-- 13-month year with 5 days in the last month
select '1/13/2016 ERA1'::icu_date + icu_interval '12 months' as d1,
'1/13/2016 ERA1'::icu_date + icu_interval '13 months' as d2,
'1/13/2016 ERA1'::icu_date + icu_interval '1 year' as d3;
d1 | d2 | d3
---------------------+---------------------+---------------------
13/5/2016, 12:00 AM | 1/13/2017, 12:00 AM | 1/13/2017, 12:00 AM
(1 row)
select '13/5/2016 ERA1'::icu_date + 1;
?column?
----------
1/1/2017
(1 row)
set icu_ext.locale to 'en@calendar=gregorian';
select icu_parse_date('17/10/2023', 'dd/MM/yyyy');
icu_parse_date
----------------
10-17-2023
(1 row)
select icu_parse_datetime('17/10/2023', 'dd/MM/yyyy');
icu_parse_datetime
-------------------------------
Tue Oct 17 00:00:00 2023 CEST
(1 row)
select icu_parse_datetime('17/10/2023 12:02:40.653', 'dd/MM/yyyy HH:mm:ss.S');
icu_parse_datetime
-----------------------------------
Tue Oct 17 12:02:40.653 2023 CEST
(1 row)
set timezone to 'GMT';
select icu_parse_datetime('17/10/2023 12:02:40.653', 'dd/MM/yyyy HH:mm:ss.S');
icu_parse_datetime
----------------------------------
Tue Oct 17 12:02:40.653 2023 GMT
(1 row)
|