Retrieve first hour in daylight savings change - GNU date

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash 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






share|improve this question




















  • 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














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






share|improve this question




















  • 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












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






share|improve this question












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








share|improve this question











share|improve this question




share|improve this question










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 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
















  • 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















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










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





share|improve this answer



























    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.






    share|improve this answer




















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      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






























      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





      share|improve this answer
























        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





        share|improve this answer






















          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





          share|improve this answer












          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






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 30 '17 at 7:20









          Satō Katsura

          10.7k11533




          10.7k11533






















              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.






              share|improve this answer
























                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.






                share|improve this answer






















                  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.






                  share|improve this answer












                  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.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Oct 31 '17 at 0:57









                  DarkHeart

                  3,38822136




                  3,38822136



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      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













































































                      PlTodh4pEiNbOiICLXsTHGtCiHSfe,B Zi7AROv mZ26 eNt2yai3 zP6cPa9XHilN,tJjH
                      U9yzgIQvbMVRhpAFOe0a29lH

                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      How many registers does an x86_64 CPU actually have?

                      Displaying single band from multi-band raster using QGIS