schochastics / timeless

A general purpose date(time) parser for R
https://schochastics.github.io/timeless/
Other
19 stars 2 forks source link

tz conversion #14 #15

Closed schochastics closed 5 months ago

schochastics commented 5 months ago

added parameter to_tz to allow timezone conversions

schochastics commented 5 months ago
library(timeless)
bench_date[5]
#> [1] "2017-11-25T22:34:50Z"
# no tz means local tz
chronos(bench_date[5])
#> [1] "2017-11-25 23:34:50 CET"
# set a tz
chronos(bench_date[5], tz = "America/Los_Angeles")
#> [1] "2017-11-25 23:34:50 PST"
# convert from set tz
chronos(bench_date[5], tz = "America/Los_Angeles", to_tz = "CET")
#> [1] "2017-11-26 08:34:50 CET"

Created on 2024-03-28 with reprex v2.1.0