-
Notifications
You must be signed in to change notification settings - Fork 37
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
Comments
Thanks. The second argument to 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")
)
#> Warning in strptime(xx, f, tz = tz): unknown timezone '%d/%m/%y %H:%M:%S'
#> Warning in as.POSIXct.POSIXlt(x): unknown timezone '%d/%m/%y %H:%M:%S'
#> Warning in strptime(xx, f, tz = tz): unknown timezone '%d/%m/%y %H:%M:%S'
#> Warning in as.POSIXct.POSIXlt(x): unknown timezone '%d/%m/%y %H:%M:%S'
#> Warning in strptime(x, f, tz = tz): unknown timezone '%d/%m/%y %H:%M:%S'
#> Warning in as.POSIXct.POSIXlt(as.POSIXlt(x, tz, ...), tz, ...): unknown
#> timezone '%d/%m/%y %H:%M:%S'
#> # A tibble: 1 × 2
#> Warning in as.POSIXlt.POSIXct(x, tz): unknown timezone '%d/%m/%y %H:%M:%S'
#> Warning in as.POSIXlt.POSIXct(x, tz): unknown timezone '%d/%m/%y %H:%M:%S'
#> a b
#> <dttm> <dttm>
#> 1 2023-04-05 19:22:21 0005-04-23 19:22:21
as.POSIXct(chr_date, "%d/%m/%y %H:%M:%S", tz = "UTC")
#> [1] "2023-04-05 19:22:21 UTC"
as.POSIXct(chr_date, "%d/%m/%y %H:%M:%S")
#> Warning in strptime(xx, f, tz = tz): unknown timezone '%d/%m/%y %H:%M:%S'
#> Warning in as.POSIXct.POSIXlt(x): unknown timezone '%d/%m/%y %H:%M:%S'
#> Warning in strptime(xx, f, tz = tz): unknown timezone '%d/%m/%y %H:%M:%S'
#> Warning in as.POSIXct.POSIXlt(x): unknown timezone '%d/%m/%y %H:%M:%S'
#> Warning in strptime(x, f, tz = tz): unknown timezone '%d/%m/%y %H:%M:%S'
#> Warning in as.POSIXct.POSIXlt(as.POSIXlt(x, tz, ...), tz, ...): unknown
#> timezone '%d/%m/%y %H:%M:%S'
#> Warning in as.POSIXlt.POSIXct(x, tz): unknown timezone '%d/%m/%y %H:%M:%S'
#> [1] "0005-04-23 19:22:21 GMT"
as.POSIXct(chr_date, format = "%d/%m/%y %H:%M:%S")
#> [1] "2023-04-05 19:22:21 CEST" Created on 2024-12-15 with reprex v2.1.1 Also trying with R 4.0. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems like (not) specifying a time zone makes datetime columns print differently?
Created on 2023-04-05 by the reprex package (v2.0.1)
Session info
The text was updated successfully, but these errors were encountered: