Skip to content

issue with flooring and ceiling dates #645

@bart1

Description

@bart1

I noticed some strange results where ceiling date sometimes does not produce a rounded date (see the example where the time becomes 1 am)

> a<-structure(631166450, class = c("POSIXct", "POSIXt"), tzone = "")
> a
[1] "1990-01-01 05:00:50 CET"
> floor_date(a,'days');ceiling_date(a,'days')
[1] "1990-01-01 CET"
[1] "1990-01-02 01:00:00 CET"
> 
> a<-structure(631166450, class = c("POSIXct", "POSIXt"), tzone = "CET")
> a
[1] "1990-01-01 05:00:50 CET"
> floor_date(a,'days');ceiling_date(a,'days')
[1] "1990-01-01 CET"
[1] "1990-01-02 CET"
> 
> Sys.timezone()
[1] "Europe/Zurich"
> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
 [1] lubridate_1.7.2 browMod_0.1     Rcpp_0.12.15    move_3.0.3      rgdal_1.2-16    raster_2.6-7    sp_1.2-7        geosphere_1.5-7 mgcv_1.8-23    
[10] nlme_3.1-131   

loaded via a namespace (and not attached):
 [1] compiler_3.4.2     pillar_1.1.0       plyr_1.8.4         tools_3.4.2        digest_0.6.15      memoise_1.1.0      tibble_1.4.2       gtable_0.2.0      
 [9] lattice_0.20-35    rlang_0.1.6        Matrix_1.2-12      yaml_2.1.16        parallel_3.4.2     gridExtra_2.3      httr_1.3.1         stringr_1.2.0     
[17] xml2_1.2.0         stats4_3.4.2       grid_3.4.2         inline_0.3.14      R6_2.2.2           rstan_2.17.3       ggplot2_2.2.1      magrittr_1.5      
[25] splines_3.4.2      scales_0.5.0       codetools_0.2-15   StanHeaders_2.17.2 colorspace_1.3-2   stringi_1.1.6      lazyeval_0.2.1     munsell_0.4.3     

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions