Transformation for date-times (class POSIXt)

time_trans(tz = NULL)

Arguments

tz

Optionally supply the time zone. If NULL, the default, the time zone will be extracted from first input with a non-null tz.

Examples

hours <- seq(ISOdate(2000,3,20, tz = ""), by = "hour", length.out = 10) t <- time_trans() t$transform(hours)
#> [1] 953571600 953575200 953578800 953582400 953586000 953589600 953593200 #> [8] 953596800 953600400 953604000
t$inverse(t$transform(hours))
#> [1] "2000-03-20 12:00:00 EST" "2000-03-20 13:00:00 EST" #> [3] "2000-03-20 14:00:00 EST" "2000-03-20 15:00:00 EST" #> [5] "2000-03-20 16:00:00 EST" "2000-03-20 17:00:00 EST" #> [7] "2000-03-20 18:00:00 EST" "2000-03-20 19:00:00 EST" #> [9] "2000-03-20 20:00:00 EST" "2000-03-20 21:00:00 EST"
t$format(t$breaks(range(hours)))
#> [1] "12:00" "15:00" "18:00" "21:00"