Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should time zones be changing datetime formatting? #643

Open
jameslairdsmith opened this issue Apr 5, 2023 · 0 comments
Open

Should time zones be changing datetime formatting? #643

jameslairdsmith opened this issue Apr 5, 2023 · 0 comments

Comments

@jameslairdsmith
Copy link

It seems like (not) specifying a time zone makes datetime columns print differently?

library(tibble)
chr_date <- "05/04/23 19:22:21"

tibble(a = as.POSIXct(chr_date, "%d/%m/%y %H:%M:%S", tz = "UTC"),
       b = as.POSIXct(chr_date, "%d/%m/%y %H:%M:%S"))
#> # A tibble: 1 × 2
#>   a                   b               
#>   <dttm>              <dttm>          
#> 1 2023-04-05 19:22:21 5-04-23 19:22:21

Created on 2023-04-05 by the reprex package (v2.0.1)

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.0.5 (2021-03-31)
#>  os       Red Hat Enterprise Linux
#>  system   x86_64, linux-gnu
#>  ui       X11
#>  language (EN)
#>  collate  en_GB.UTF-8
#>  ctype    en_GB.UTF-8
#>  tz       Europe/London
#>  date     2023-04-05
#>  pandoc   2.14.0.3 @ /usr/lib/rstudio-server/bin/pandoc/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version date (UTC) lib source
#>  cli           3.6.0   2023-01-09 [1] CRAN (R 4.0.5)
#>  digest        0.6.31  2022-12-11 [1] CRAN (R 4.0.5)
#>  evaluate      0.20    2023-01-17 [1] CRAN (R 4.0.5)
#>  fansi         1.0.3   2022-03-24 [1] CRAN (R 4.0.5)
#>  fastmap       1.1.0   2021-01-25 [1] CRAN (R 4.0.5)
#>  fs            1.6.1   2023-02-06 [1] CRAN (R 4.0.5)
#>  glue          1.6.2   2022-02-24 [1] CRAN (R 4.0.5)
#>  htmltools     0.5.4   2022-12-07 [1] CRAN (R 4.0.5)
#>  knitr         1.42    2023-01-25 [1] CRAN (R 4.0.5)
#>  lifecycle     1.0.3   2022-10-07 [1] CRAN (R 4.0.5)
#>  magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.0.5)
#>  pillar        1.8.1   2022-08-19 [1] CRAN (R 4.0.5)
#>  pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.0.5)
#>  purrr         0.3.4   2020-04-17 [1] CRAN (R 4.0.5)
#>  R.cache       0.16.0  2022-07-21 [1] CRAN (R 4.0.5)
#>  R.methodsS3   1.8.2   2022-06-13 [1] CRAN (R 4.0.5)
#>  R.oo          1.25.0  2022-06-12 [1] CRAN (R 4.0.5)
#>  R.utils       2.12.1  2022-10-30 [1] CRAN (R 4.0.5)
#>  reprex        2.0.1   2021-08-05 [2] CRAN (R 4.0.5)
#>  rlang         1.0.6   2022-09-24 [1] CRAN (R 4.0.5)
#>  rmarkdown     2.20    2023-01-19 [1] CRAN (R 4.0.5)
#>  rstudioapi    0.13    2020-11-12 [2] CRAN (R 4.0.5)
#>  sessioninfo   1.2.2   2021-12-06 [2] CRAN (R 4.0.5)
#>  styler        1.8.1   2022-11-07 [1] CRAN (R 4.0.5)
#>  tibble      * 3.1.8   2022-07-22 [1] CRAN (R 4.0.5)
#>  utf8          1.2.2   2021-07-24 [1] CRAN (R 4.0.5)
#>  vctrs         0.5.0   2022-10-22 [1] CRAN (R 4.0.5)
#>  withr         2.5.0   2022-03-03 [1] CRAN (R 4.0.5)
#>  xfun          0.37    2023-01-31 [1] CRAN (R 4.0.5)
#>  yaml          2.3.7   2023-01-23 [1] CRAN (R 4.0.5)
#> 
#>  [1] /home/333573/R/x86_64-pc-linux-gnu-library/4.0
#>  [2] /opt/R/4.0.5/lib/R/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────
@jameslairdsmith jameslairdsmith changed the title Should time zones changing datetime formatting? Should time zones be changing datetime formatting? Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant