Retrieve first hour in daylight savings change - GNU date
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
Last weekend most of Western Europe shifted back one hour - there were two instances of 2017-10-29T02:00
.
To translate the time into UTC I can use GNU date:
$ date -d 'TZ="Europe/Rome" 2017-10-29 02:00'
Sun Oct 29 01:00:00 UTC 2017
This returns the time in CET (ie the second 2am). How do I get date
to return Sun Oct 29 00:00:00 UTC 2017
(the first 2am - CEST)?
Info:
$ date --version
date (GNU coreutils) 8.21
date coreutils
add a comment |Â
up vote
1
down vote
favorite
Last weekend most of Western Europe shifted back one hour - there were two instances of 2017-10-29T02:00
.
To translate the time into UTC I can use GNU date:
$ date -d 'TZ="Europe/Rome" 2017-10-29 02:00'
Sun Oct 29 01:00:00 UTC 2017
This returns the time in CET (ie the second 2am). How do I get date
to return Sun Oct 29 00:00:00 UTC 2017
(the first 2am - CEST)?
Info:
$ date --version
date (GNU coreutils) 8.21
date coreutils
Actually, CEST ended on October 29, at 3:00 AM. So, 2 AM CET was 3 AM CEST.
â kiamlaluno
Oct 30 '17 at 6:06
@kiamlaluno - I thought thatâÂÂs what I said. At 3am the clocks went back an hour to 2am - ie two 2 AMs
â DarkHeart
Oct 30 '17 at 6:21
Did you trydate -u
?
â Serge
Oct 30 '17 at 7:03
You are saying you get Sun Oct 29 01:00:00 UTC 2017 as output ofdate -d 'TZ="Europe/Rome" 2017-10-29 02:00'
and you would want to get Sun Oct 29 00:00:00 UTC 2017, which is two hours earlier than the input. That is not just changing from CEST to CET or vice versa. On October 29, 2017, 2:00 AM CEST is 2:00 AM CEST, and 2:00 AM CET is 3:00 AM CEST.
â kiamlaluno
Oct 30 '17 at 9:13
@kiamlaluno - Yes I want to change UTC to Europe time - havingdate
translate both hours (2am CEST and 2am CET) not just the one.
â DarkHeart
Oct 31 '17 at 0:20
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Last weekend most of Western Europe shifted back one hour - there were two instances of 2017-10-29T02:00
.
To translate the time into UTC I can use GNU date:
$ date -d 'TZ="Europe/Rome" 2017-10-29 02:00'
Sun Oct 29 01:00:00 UTC 2017
This returns the time in CET (ie the second 2am). How do I get date
to return Sun Oct 29 00:00:00 UTC 2017
(the first 2am - CEST)?
Info:
$ date --version
date (GNU coreutils) 8.21
date coreutils
Last weekend most of Western Europe shifted back one hour - there were two instances of 2017-10-29T02:00
.
To translate the time into UTC I can use GNU date:
$ date -d 'TZ="Europe/Rome" 2017-10-29 02:00'
Sun Oct 29 01:00:00 UTC 2017
This returns the time in CET (ie the second 2am). How do I get date
to return Sun Oct 29 00:00:00 UTC 2017
(the first 2am - CEST)?
Info:
$ date --version
date (GNU coreutils) 8.21
date coreutils
asked Oct 30 '17 at 1:24
DarkHeart
3,38822136
3,38822136
Actually, CEST ended on October 29, at 3:00 AM. So, 2 AM CET was 3 AM CEST.
â kiamlaluno
Oct 30 '17 at 6:06
@kiamlaluno - I thought thatâÂÂs what I said. At 3am the clocks went back an hour to 2am - ie two 2 AMs
â DarkHeart
Oct 30 '17 at 6:21
Did you trydate -u
?
â Serge
Oct 30 '17 at 7:03
You are saying you get Sun Oct 29 01:00:00 UTC 2017 as output ofdate -d 'TZ="Europe/Rome" 2017-10-29 02:00'
and you would want to get Sun Oct 29 00:00:00 UTC 2017, which is two hours earlier than the input. That is not just changing from CEST to CET or vice versa. On October 29, 2017, 2:00 AM CEST is 2:00 AM CEST, and 2:00 AM CET is 3:00 AM CEST.
â kiamlaluno
Oct 30 '17 at 9:13
@kiamlaluno - Yes I want to change UTC to Europe time - havingdate
translate both hours (2am CEST and 2am CET) not just the one.
â DarkHeart
Oct 31 '17 at 0:20
add a comment |Â
Actually, CEST ended on October 29, at 3:00 AM. So, 2 AM CET was 3 AM CEST.
â kiamlaluno
Oct 30 '17 at 6:06
@kiamlaluno - I thought thatâÂÂs what I said. At 3am the clocks went back an hour to 2am - ie two 2 AMs
â DarkHeart
Oct 30 '17 at 6:21
Did you trydate -u
?
â Serge
Oct 30 '17 at 7:03
You are saying you get Sun Oct 29 01:00:00 UTC 2017 as output ofdate -d 'TZ="Europe/Rome" 2017-10-29 02:00'
and you would want to get Sun Oct 29 00:00:00 UTC 2017, which is two hours earlier than the input. That is not just changing from CEST to CET or vice versa. On October 29, 2017, 2:00 AM CEST is 2:00 AM CEST, and 2:00 AM CET is 3:00 AM CEST.
â kiamlaluno
Oct 30 '17 at 9:13
@kiamlaluno - Yes I want to change UTC to Europe time - havingdate
translate both hours (2am CEST and 2am CET) not just the one.
â DarkHeart
Oct 31 '17 at 0:20
Actually, CEST ended on October 29, at 3:00 AM. So, 2 AM CET was 3 AM CEST.
â kiamlaluno
Oct 30 '17 at 6:06
Actually, CEST ended on October 29, at 3:00 AM. So, 2 AM CET was 3 AM CEST.
â kiamlaluno
Oct 30 '17 at 6:06
@kiamlaluno - I thought thatâÂÂs what I said. At 3am the clocks went back an hour to 2am - ie two 2 AMs
â DarkHeart
Oct 30 '17 at 6:21
@kiamlaluno - I thought thatâÂÂs what I said. At 3am the clocks went back an hour to 2am - ie two 2 AMs
â DarkHeart
Oct 30 '17 at 6:21
Did you try
date -u
?â Serge
Oct 30 '17 at 7:03
Did you try
date -u
?â Serge
Oct 30 '17 at 7:03
You are saying you get Sun Oct 29 01:00:00 UTC 2017 as output of
date -d 'TZ="Europe/Rome" 2017-10-29 02:00'
and you would want to get Sun Oct 29 00:00:00 UTC 2017, which is two hours earlier than the input. That is not just changing from CEST to CET or vice versa. On October 29, 2017, 2:00 AM CEST is 2:00 AM CEST, and 2:00 AM CET is 3:00 AM CEST.â kiamlaluno
Oct 30 '17 at 9:13
You are saying you get Sun Oct 29 01:00:00 UTC 2017 as output of
date -d 'TZ="Europe/Rome" 2017-10-29 02:00'
and you would want to get Sun Oct 29 00:00:00 UTC 2017, which is two hours earlier than the input. That is not just changing from CEST to CET or vice versa. On October 29, 2017, 2:00 AM CEST is 2:00 AM CEST, and 2:00 AM CET is 3:00 AM CEST.â kiamlaluno
Oct 30 '17 at 9:13
@kiamlaluno - Yes I want to change UTC to Europe time - having
date
translate both hours (2am CEST and 2am CET) not just the one.â DarkHeart
Oct 31 '17 at 0:20
@kiamlaluno - Yes I want to change UTC to Europe time - having
date
translate both hours (2am CEST and 2am CET) not just the one.â DarkHeart
Oct 31 '17 at 0:20
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
1
down vote
The reference for timezone changes is zdump
:
$ /usr/sbin/zdump -v -c 2017,2018 Europe/Rome
Europe/Rome -9223372036854775808 = NULL
Europe/Rome -9223372036854689408 = NULL
Europe/Rome Sun Mar 26 00:59:59 2017 UTC = Sun Mar 26 01:59:59 2017 CET isdst=0
Europe/Rome Sun Mar 26 01:00:00 2017 UTC = Sun Mar 26 03:00:00 2017 CEST isdst=1
Europe/Rome Sun Oct 29 00:59:59 2017 UTC = Sun Oct 29 02:59:59 2017 CEST isdst=1
Europe/Rome Sun Oct 29 01:00:00 2017 UTC = Sun Oct 29 02:00:00 2017 CET isdst=0
Europe/Rome 9223372036854689407 = NULL
Europe/Rome 9223372036854775807 = NULL
add a comment |Â
up vote
1
down vote
accepted
The time TZ="Europe/Rome" 2017-10-29 02:00
is ambiguous since this translates to two different UTC times, 00:00
and 01:00
.
How to make date return both is to specify the exact timezone itself, eg
$ date -ud 'TZ="Europe/Rome" 02:00:00 10/29/2017 CEST'
Sun Oct 29 00:00:00 UTC 2017
$ date -ud 'TZ="Europe/Rome" 02:00:00 10/29/2017 CET'
Sun Oct 29 01:00:00 UTC 2017
However this means you have to work out the timezone outside the date command.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
The reference for timezone changes is zdump
:
$ /usr/sbin/zdump -v -c 2017,2018 Europe/Rome
Europe/Rome -9223372036854775808 = NULL
Europe/Rome -9223372036854689408 = NULL
Europe/Rome Sun Mar 26 00:59:59 2017 UTC = Sun Mar 26 01:59:59 2017 CET isdst=0
Europe/Rome Sun Mar 26 01:00:00 2017 UTC = Sun Mar 26 03:00:00 2017 CEST isdst=1
Europe/Rome Sun Oct 29 00:59:59 2017 UTC = Sun Oct 29 02:59:59 2017 CEST isdst=1
Europe/Rome Sun Oct 29 01:00:00 2017 UTC = Sun Oct 29 02:00:00 2017 CET isdst=0
Europe/Rome 9223372036854689407 = NULL
Europe/Rome 9223372036854775807 = NULL
add a comment |Â
up vote
1
down vote
The reference for timezone changes is zdump
:
$ /usr/sbin/zdump -v -c 2017,2018 Europe/Rome
Europe/Rome -9223372036854775808 = NULL
Europe/Rome -9223372036854689408 = NULL
Europe/Rome Sun Mar 26 00:59:59 2017 UTC = Sun Mar 26 01:59:59 2017 CET isdst=0
Europe/Rome Sun Mar 26 01:00:00 2017 UTC = Sun Mar 26 03:00:00 2017 CEST isdst=1
Europe/Rome Sun Oct 29 00:59:59 2017 UTC = Sun Oct 29 02:59:59 2017 CEST isdst=1
Europe/Rome Sun Oct 29 01:00:00 2017 UTC = Sun Oct 29 02:00:00 2017 CET isdst=0
Europe/Rome 9223372036854689407 = NULL
Europe/Rome 9223372036854775807 = NULL
add a comment |Â
up vote
1
down vote
up vote
1
down vote
The reference for timezone changes is zdump
:
$ /usr/sbin/zdump -v -c 2017,2018 Europe/Rome
Europe/Rome -9223372036854775808 = NULL
Europe/Rome -9223372036854689408 = NULL
Europe/Rome Sun Mar 26 00:59:59 2017 UTC = Sun Mar 26 01:59:59 2017 CET isdst=0
Europe/Rome Sun Mar 26 01:00:00 2017 UTC = Sun Mar 26 03:00:00 2017 CEST isdst=1
Europe/Rome Sun Oct 29 00:59:59 2017 UTC = Sun Oct 29 02:59:59 2017 CEST isdst=1
Europe/Rome Sun Oct 29 01:00:00 2017 UTC = Sun Oct 29 02:00:00 2017 CET isdst=0
Europe/Rome 9223372036854689407 = NULL
Europe/Rome 9223372036854775807 = NULL
The reference for timezone changes is zdump
:
$ /usr/sbin/zdump -v -c 2017,2018 Europe/Rome
Europe/Rome -9223372036854775808 = NULL
Europe/Rome -9223372036854689408 = NULL
Europe/Rome Sun Mar 26 00:59:59 2017 UTC = Sun Mar 26 01:59:59 2017 CET isdst=0
Europe/Rome Sun Mar 26 01:00:00 2017 UTC = Sun Mar 26 03:00:00 2017 CEST isdst=1
Europe/Rome Sun Oct 29 00:59:59 2017 UTC = Sun Oct 29 02:59:59 2017 CEST isdst=1
Europe/Rome Sun Oct 29 01:00:00 2017 UTC = Sun Oct 29 02:00:00 2017 CET isdst=0
Europe/Rome 9223372036854689407 = NULL
Europe/Rome 9223372036854775807 = NULL
answered Oct 30 '17 at 7:20
Satà  Katsura
10.7k11533
10.7k11533
add a comment |Â
add a comment |Â
up vote
1
down vote
accepted
The time TZ="Europe/Rome" 2017-10-29 02:00
is ambiguous since this translates to two different UTC times, 00:00
and 01:00
.
How to make date return both is to specify the exact timezone itself, eg
$ date -ud 'TZ="Europe/Rome" 02:00:00 10/29/2017 CEST'
Sun Oct 29 00:00:00 UTC 2017
$ date -ud 'TZ="Europe/Rome" 02:00:00 10/29/2017 CET'
Sun Oct 29 01:00:00 UTC 2017
However this means you have to work out the timezone outside the date command.
add a comment |Â
up vote
1
down vote
accepted
The time TZ="Europe/Rome" 2017-10-29 02:00
is ambiguous since this translates to two different UTC times, 00:00
and 01:00
.
How to make date return both is to specify the exact timezone itself, eg
$ date -ud 'TZ="Europe/Rome" 02:00:00 10/29/2017 CEST'
Sun Oct 29 00:00:00 UTC 2017
$ date -ud 'TZ="Europe/Rome" 02:00:00 10/29/2017 CET'
Sun Oct 29 01:00:00 UTC 2017
However this means you have to work out the timezone outside the date command.
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
The time TZ="Europe/Rome" 2017-10-29 02:00
is ambiguous since this translates to two different UTC times, 00:00
and 01:00
.
How to make date return both is to specify the exact timezone itself, eg
$ date -ud 'TZ="Europe/Rome" 02:00:00 10/29/2017 CEST'
Sun Oct 29 00:00:00 UTC 2017
$ date -ud 'TZ="Europe/Rome" 02:00:00 10/29/2017 CET'
Sun Oct 29 01:00:00 UTC 2017
However this means you have to work out the timezone outside the date command.
The time TZ="Europe/Rome" 2017-10-29 02:00
is ambiguous since this translates to two different UTC times, 00:00
and 01:00
.
How to make date return both is to specify the exact timezone itself, eg
$ date -ud 'TZ="Europe/Rome" 02:00:00 10/29/2017 CEST'
Sun Oct 29 00:00:00 UTC 2017
$ date -ud 'TZ="Europe/Rome" 02:00:00 10/29/2017 CET'
Sun Oct 29 01:00:00 UTC 2017
However this means you have to work out the timezone outside the date command.
answered Oct 31 '17 at 0:57
DarkHeart
3,38822136
3,38822136
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f401326%2fretrieve-first-hour-in-daylight-savings-change-gnu-date%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Actually, CEST ended on October 29, at 3:00 AM. So, 2 AM CET was 3 AM CEST.
â kiamlaluno
Oct 30 '17 at 6:06
@kiamlaluno - I thought thatâÂÂs what I said. At 3am the clocks went back an hour to 2am - ie two 2 AMs
â DarkHeart
Oct 30 '17 at 6:21
Did you try
date -u
?â Serge
Oct 30 '17 at 7:03
You are saying you get Sun Oct 29 01:00:00 UTC 2017 as output of
date -d 'TZ="Europe/Rome" 2017-10-29 02:00'
and you would want to get Sun Oct 29 00:00:00 UTC 2017, which is two hours earlier than the input. That is not just changing from CEST to CET or vice versa. On October 29, 2017, 2:00 AM CEST is 2:00 AM CEST, and 2:00 AM CET is 3:00 AM CEST.â kiamlaluno
Oct 30 '17 at 9:13
@kiamlaluno - Yes I want to change UTC to Europe time - having
date
translate both hours (2am CEST and 2am CET) not just the one.â DarkHeart
Oct 31 '17 at 0:20