I have observed incorrect handling of "Military" timezones when exercising the --date=... option of the GNU coreutils "date" utility. I believe the underlying problem is with initialization of "military_table[]" in the parse-datetime.y file of gnulib.
In Military Time, timezone letters "A" through "M" are supposed to indicate zones progressively east of the prime meridian (local clocks read some hours ahead of UTC), and "N" through "Y" progressively west of the prime meridian (local clocks read some hours behind UTC), with "Z" standing for the UTC+0 timezone. Reference: https://aa.usno.navy.mil/faq/docs/world_tzones.php Utilities using parse-datetime routines interpret correctly interpret "Z" as UTC, but all the letters the wrong way around: zone "A" should be one hour ahead of UTC (Paris, France when not observing DST for example), but parse-datetime has it one hour behind: $ TZ=UTC ./date --date='12:00A 2019-01-01' Tue 1 Jan 13:00:00 UTC 2019 $ TZ=UTC ./date --date='12:00+0100 2019-01-01' Tue 1 Jan 11:00:00 UTC 2019 $ TZ=UTC ./date --date='TZ="Europe/Paris" 1200 2019-01-01' Tue 1 Jan 11:00:00 UTC 2019 $ TZ=UTC ./date --date='12:00CET 2019-01-01' Tue 1 Jan 11:00:00 UTC 2019 Similarly, when not observing DST then US Eastern Standard Time is 5-hours behind UTC, in the "R for Romeo" timezone, but an "R" passed to parse-datetime shifts the time 5 hours in the wrong direction: $ TZ=UTC ./date --date='12:00R 2019-01-01' Tue 1 Jan 07:00:00 UTC 2019 $ TZ=UTC ./date --date='12:00-0500 2019-01-01' Tue 1 Jan 17:00:00 UTC 2019 $ TZ=UTC ./date --date='TZ="America/New_York" 12:00 2019-01-01' Tue 1 Jan 17:00:00 UTC 2019 $ TZ=UTC ./date --date='12:00EST 2019-01-01' Tue 1 Jan 17:00:00 UTC 2019 The following trivial change makes the routine and utilities using it work as expected: --- a/lib/parse-datetime.y +++ b/lib/parse-datetime.y @@ -1164,30 +1164,30 @@ static table const time_zone_table[] = 8601 date and time of day representation. */ static table const military_table[] = { - { "A", tZONE, -HOUR ( 1) }, - { "B", tZONE, -HOUR ( 2) }, - { "C", tZONE, -HOUR ( 3) }, - { "D", tZONE, -HOUR ( 4) }, - { "E", tZONE, -HOUR ( 5) }, - { "F", tZONE, -HOUR ( 6) }, - { "G", tZONE, -HOUR ( 7) }, - { "H", tZONE, -HOUR ( 8) }, - { "I", tZONE, -HOUR ( 9) }, - { "K", tZONE, -HOUR (10) }, - { "L", tZONE, -HOUR (11) }, - { "M", tZONE, -HOUR (12) }, - { "N", tZONE, HOUR ( 1) }, - { "O", tZONE, HOUR ( 2) }, - { "P", tZONE, HOUR ( 3) }, - { "Q", tZONE, HOUR ( 4) }, - { "R", tZONE, HOUR ( 5) }, - { "S", tZONE, HOUR ( 6) }, + { "A", tZONE, HOUR ( 1) }, + { "B", tZONE, HOUR ( 2) }, + { "C", tZONE, HOUR ( 3) }, + { "D", tZONE, HOUR ( 4) }, + { "E", tZONE, HOUR ( 5) }, + { "F", tZONE, HOUR ( 6) }, + { "G", tZONE, HOUR ( 7) }, + { "H", tZONE, HOUR ( 8) }, + { "I", tZONE, HOUR ( 9) }, + { "K", tZONE, HOUR (10) }, + { "L", tZONE, HOUR (11) }, + { "M", tZONE, HOUR (12) }, + { "N", tZONE, -HOUR ( 1) }, + { "O", tZONE, -HOUR ( 2) }, + { "P", tZONE, -HOUR ( 3) }, + { "Q", tZONE, -HOUR ( 4) }, + { "R", tZONE, -HOUR ( 5) }, + { "S", tZONE, -HOUR ( 6) }, { "T", 'T', 0 }, - { "U", tZONE, HOUR ( 8) }, - { "V", tZONE, HOUR ( 9) }, - { "W", tZONE, HOUR (10) }, - { "X", tZONE, HOUR (11) }, - { "Y", tZONE, HOUR (12) }, + { "U", tZONE, -HOUR ( 8) }, + { "V", tZONE, -HOUR ( 9) }, + { "W", tZONE, -HOUR (10) }, + { "X", tZONE, -HOUR (11) }, + { "Y", tZONE, -HOUR (12) }, { "Z", tZONE, HOUR ( 0) }, { NULL, 0, 0 } }; Regards, Neil Hoggarth