Description Usage Arguments Examples
Convert a time string to a POSIXct object. Allow for different possible timestamp formats.
1 2 3 4 5 | stringToPosix(
x,
formats = c("%Y-%m-%d %H:%M:%S", "%Y-%m-%d %H:%M", "%Y-%m-%d"),
...
)
|
x |
character vector of length one representing a timestamp |
formats |
vector of allowed time formats (using %-placeholders) |
... |
arguments passed to |
1 2 3 4 5 6 7 8 9 10 11 12 13 | stringToPosix("2016-05-26")
stringToPosix("2016-05-26 12:00")
# additional arguments passed to hsToPosix
stringToPosix("2016-05-26 12:00:33", tzone = "ETC/Gmt-1")
# lt = TRUE -> create POSIXlt instead of POSIXct
lt1 <- stringToPosix("2016-05-26 17:00", lt = TRUE)
lt2 <- stringToPosix("2016-05-26 17:00", lt = TRUE, tz = "Europe/Berlin")
lt1$hour
lt1$isdst # normal time (is daylight saving time = FALSE)
lt2$isdst # summer time (is daylight saving time = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.