Unexpected POSIXct behavior for minutes











up vote
0
down vote

favorite












I do not understand why POSIXct returns NA for certain times? It does not make sense that for exactly that day, the function does not work.



> as.POSIXct("201003280501", format = "%Y%m%d%H%M", tz = "CET")
[1] "2010-03-28 05:01:00 CEST"
> as.POSIXct("201003280301", format = "%Y%m%d%H%M", tz = "CET")
[1] "2010-03-28 03:01:00 CEST"
> as.POSIXct("201003280201", format = "%Y%m%d%H%M", tz = "CET")
[1] NA
> as.POSIXct("201003290201", format = "%Y%m%d%H%M", tz = "CET")
[1] "2010-03-29 02:01:00 CEST"


Lubridate works



> lubridate::as_datetime("201003280201", format = "%Y%m%d%H%M", tz = "CET")
[1] "2010-03-28 02:01:00"


Any suggestions of what is going on?



R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=Danish_Denmark.1252 LC_CTYPE=Danish_Denmark.1252 LC_MONETARY=Danish_Denmark.1252 LC_NUMERIC=C
[5] LC_TIME=Danish_Denmark.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] readr_1.1.1 rjson_0.2.20 odbc_1.1.6 DBI_1.0.0 data.table_1.11.8

loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 crayon_1.3.4 R6_2.3.0 pillar_1.3.0 rlang_0.3.0.1 rstudioapi_0.8 blob_1.1.1 tools_3.5.1 bit64_0.9-7
[10] bit_1.1-14 hms_0.4.2 yaml_2.2.0 compiler_3.5.1 pkgconfig_2.0.2 tibble_1.4.2









share|improve this question




























    up vote
    0
    down vote

    favorite












    I do not understand why POSIXct returns NA for certain times? It does not make sense that for exactly that day, the function does not work.



    > as.POSIXct("201003280501", format = "%Y%m%d%H%M", tz = "CET")
    [1] "2010-03-28 05:01:00 CEST"
    > as.POSIXct("201003280301", format = "%Y%m%d%H%M", tz = "CET")
    [1] "2010-03-28 03:01:00 CEST"
    > as.POSIXct("201003280201", format = "%Y%m%d%H%M", tz = "CET")
    [1] NA
    > as.POSIXct("201003290201", format = "%Y%m%d%H%M", tz = "CET")
    [1] "2010-03-29 02:01:00 CEST"


    Lubridate works



    > lubridate::as_datetime("201003280201", format = "%Y%m%d%H%M", tz = "CET")
    [1] "2010-03-28 02:01:00"


    Any suggestions of what is going on?



    R version 3.5.1 (2018-07-02)
    Platform: x86_64-w64-mingw32/x64 (64-bit)
    Running under: Windows >= 8 x64 (build 9200)

    Matrix products: default

    locale:
    [1] LC_COLLATE=Danish_Denmark.1252 LC_CTYPE=Danish_Denmark.1252 LC_MONETARY=Danish_Denmark.1252 LC_NUMERIC=C
    [5] LC_TIME=Danish_Denmark.1252

    attached base packages:
    [1] stats graphics grDevices utils datasets methods base

    other attached packages:
    [1] readr_1.1.1 rjson_0.2.20 odbc_1.1.6 DBI_1.0.0 data.table_1.11.8

    loaded via a namespace (and not attached):
    [1] Rcpp_1.0.0 crayon_1.3.4 R6_2.3.0 pillar_1.3.0 rlang_0.3.0.1 rstudioapi_0.8 blob_1.1.1 tools_3.5.1 bit64_0.9-7
    [10] bit_1.1-14 hms_0.4.2 yaml_2.2.0 compiler_3.5.1 pkgconfig_2.0.2 tibble_1.4.2









    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I do not understand why POSIXct returns NA for certain times? It does not make sense that for exactly that day, the function does not work.



      > as.POSIXct("201003280501", format = "%Y%m%d%H%M", tz = "CET")
      [1] "2010-03-28 05:01:00 CEST"
      > as.POSIXct("201003280301", format = "%Y%m%d%H%M", tz = "CET")
      [1] "2010-03-28 03:01:00 CEST"
      > as.POSIXct("201003280201", format = "%Y%m%d%H%M", tz = "CET")
      [1] NA
      > as.POSIXct("201003290201", format = "%Y%m%d%H%M", tz = "CET")
      [1] "2010-03-29 02:01:00 CEST"


      Lubridate works



      > lubridate::as_datetime("201003280201", format = "%Y%m%d%H%M", tz = "CET")
      [1] "2010-03-28 02:01:00"


      Any suggestions of what is going on?



      R version 3.5.1 (2018-07-02)
      Platform: x86_64-w64-mingw32/x64 (64-bit)
      Running under: Windows >= 8 x64 (build 9200)

      Matrix products: default

      locale:
      [1] LC_COLLATE=Danish_Denmark.1252 LC_CTYPE=Danish_Denmark.1252 LC_MONETARY=Danish_Denmark.1252 LC_NUMERIC=C
      [5] LC_TIME=Danish_Denmark.1252

      attached base packages:
      [1] stats graphics grDevices utils datasets methods base

      other attached packages:
      [1] readr_1.1.1 rjson_0.2.20 odbc_1.1.6 DBI_1.0.0 data.table_1.11.8

      loaded via a namespace (and not attached):
      [1] Rcpp_1.0.0 crayon_1.3.4 R6_2.3.0 pillar_1.3.0 rlang_0.3.0.1 rstudioapi_0.8 blob_1.1.1 tools_3.5.1 bit64_0.9-7
      [10] bit_1.1-14 hms_0.4.2 yaml_2.2.0 compiler_3.5.1 pkgconfig_2.0.2 tibble_1.4.2









      share|improve this question















      I do not understand why POSIXct returns NA for certain times? It does not make sense that for exactly that day, the function does not work.



      > as.POSIXct("201003280501", format = "%Y%m%d%H%M", tz = "CET")
      [1] "2010-03-28 05:01:00 CEST"
      > as.POSIXct("201003280301", format = "%Y%m%d%H%M", tz = "CET")
      [1] "2010-03-28 03:01:00 CEST"
      > as.POSIXct("201003280201", format = "%Y%m%d%H%M", tz = "CET")
      [1] NA
      > as.POSIXct("201003290201", format = "%Y%m%d%H%M", tz = "CET")
      [1] "2010-03-29 02:01:00 CEST"


      Lubridate works



      > lubridate::as_datetime("201003280201", format = "%Y%m%d%H%M", tz = "CET")
      [1] "2010-03-28 02:01:00"


      Any suggestions of what is going on?



      R version 3.5.1 (2018-07-02)
      Platform: x86_64-w64-mingw32/x64 (64-bit)
      Running under: Windows >= 8 x64 (build 9200)

      Matrix products: default

      locale:
      [1] LC_COLLATE=Danish_Denmark.1252 LC_CTYPE=Danish_Denmark.1252 LC_MONETARY=Danish_Denmark.1252 LC_NUMERIC=C
      [5] LC_TIME=Danish_Denmark.1252

      attached base packages:
      [1] stats graphics grDevices utils datasets methods base

      other attached packages:
      [1] readr_1.1.1 rjson_0.2.20 odbc_1.1.6 DBI_1.0.0 data.table_1.11.8

      loaded via a namespace (and not attached):
      [1] Rcpp_1.0.0 crayon_1.3.4 R6_2.3.0 pillar_1.3.0 rlang_0.3.0.1 rstudioapi_0.8 blob_1.1.1 tools_3.5.1 bit64_0.9-7
      [10] bit_1.1-14 hms_0.4.2 yaml_2.2.0 compiler_3.5.1 pkgconfig_2.0.2 tibble_1.4.2






      posixct






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 22 at 12:02

























      asked Nov 22 at 11:09









      Esben Eickhardt

      538415




      538415
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          I turns out that it is the day where you jump from winter time to summer time, thus the hour does not exist.






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            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: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53429647%2funexpected-posixct-behavior-for-minutes%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote



            accepted










            I turns out that it is the day where you jump from winter time to summer time, thus the hour does not exist.






            share|improve this answer

























              up vote
              0
              down vote



              accepted










              I turns out that it is the day where you jump from winter time to summer time, thus the hour does not exist.






              share|improve this answer























                up vote
                0
                down vote



                accepted







                up vote
                0
                down vote



                accepted






                I turns out that it is the day where you jump from winter time to summer time, thus the hour does not exist.






                share|improve this answer












                I turns out that it is the day where you jump from winter time to summer time, thus the hour does not exist.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 28 at 18:00









                Esben Eickhardt

                538415




                538415






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53429647%2funexpected-posixct-behavior-for-minutes%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown