On 08-07-2020 20:16, Pavel Cisar wrote:
As I said, CET is a zone that has a DST rule, that means that - for
example - on 2020-01-01, 12:30 CET is 11:30 UTC, while at 2020-06-02,
12:30 CET (== 12:30 CEST) is 10:30 UTC.
CET is NOT a zone with DTS rule, CET (Central European Time) is 1 hour
ahead of Coordinated Universal Time (UTC). This time zone is in use
during standard time in: Europe, Africa. Some places observe daylight
saving time/summer time during the summer, and therefore use CEST
(Central European Summer Time) in the summer. So, timezones like
'Europe/Prague' HAVE DST rules where they switch between CET and CEST.
For example Algeria and Tunisia have CET the whole year as they don't
switch to CEST.
And that is yet another reason not to use the short time zone ids,
because they are ambiguous, the ICU time zone database does apply DST
rules to CET:
SQL> select EXTRACT(TIMEZONE_HOUR from timestamp'2020-01-01 20:58:00
CET') from rdb$database;
EXTRACT
=======
1
SQL> select EXTRACT(TIMEZONE_HOUR from timestamp'2020-06-01 20:58:00
CET') from rdb$database;
EXTRACT
=======
2
With transitions for CET:
SQL> select * from RDB$TIME_ZONE_UTIL.TRANSITIONS('CET', timestamp
'2019-01-01', timestamp '2022-01-01');
RDB$START_TIMESTAMP RDB$END_TIMESTAMP
RDB$ZONE_OFFSET RDB$DST_OFFSET RDB$EFFECTIVE_OFFSET
============================ ============================
=============== ============== ====================
2018-10-28 01:00:00.0000 GMT 2019-03-31 00:59:59.9999 GMT
60 0 60
2019-03-31 01:00:00.0000 GMT 2019-10-27 00:59:59.9999 GMT
60 60 120
2019-10-27 01:00:00.0000 GMT 2020-03-29 00:59:59.9999 GMT
60 0 60
2020-03-29 01:00:00.0000 GMT 2020-10-25 00:59:59.9999 GMT
60 60 120
2020-10-25 01:00:00.0000 GMT 2021-03-28 00:59:59.9999 GMT
60 0 60
2021-03-28 01:00:00.0000 GMT 2021-10-31 00:59:59.9999 GMT
60 60 120
2021-10-31 01:00:00.0000 GMT 2022-03-27 00:59:59.9999 GMT
60 0 60
SQL>
And these transitions are the same as for example Europe/Amsterdam and
Europe/Prague, but not the same as for example Africa/Tunis.
Similar things happen in Java (which uses the IANA tzdb):
For this code:
ZoneId zone = ZoneId.of("CET");
ZonedDateTime dt1 = ZonedDateTime
.of(LocalDateTime.parse("2020-01-01T20:58:00"), zone);
System.out.println(dt1);
System.out.println(dt1.toOffsetDateTime());
ZonedDateTime dt2 = ZonedDateTime
.of(LocalDateTime.parse("2020-06-01T20:58:00"), zone);
System.out.println(dt2);
System.out.println(dt2.toOffsetDateTime());
The following is printed:
2020-01-01T20:58+01:00[CET]
2020-01-01T20:58+01:00
2020-06-01T20:58+02:00[CET]
2020-06-01T20:58+02:00
Mark
--
Mark Rotteveel
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel