| as_timestamp | R Documentation |
This function generates a vector of character strings or POSIXcts that
represent the date and time in a selectable combination for each offset.
as_timestamp(t, format = NULL, asPOSIX = FALSE)
t |
The |
format |
character. A character string with either of the values "date" or "timestamp". If the argument is not specified, the format used is "timestamp" if there is time information, "date" otherwise. |
asPOSIX |
logical. If |
The character strings use the format YYYY-MM-DDThh:mm:ss±hhmm, depending on
the format specifier. The date in the string is not necessarily compatible
with POSIXt - in the 360_day calendar 2017-02-30 is valid and
2017-03-31 is not.
For the "proleptic_gregorian" calendar the output can also be generated as a
vector of POSIXct values by specifying asPOSIX = TRUE. The same is
possible for the "standard" and "gregorian" calendars but only if all
timestamps fall on or after 1582-10-15.
A character vector where each element represents a moment in time
according to the format specifier.
The CFTime format() method gives greater flexibility through
the use of strptime-like format specifiers.
t <- CFtime("hours since 2020-01-01", "standard", seq(0, 24, by = 0.25))
as_timestamp(t, "timestamp")
t2 <- CFtime("days since 2002-01-21", "standard", 0:20)
tail(as_timestamp(t2, asPOSIX = TRUE))
tail(as_timestamp(t2))
tail(as_timestamp(t2 + 1.5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.