Convert unix timestamp to formated date/time string
timestap_dt_str(
timestamp,
format = "%Y-%m-%d %H:%M:%S",
tz = "",
usetz = FALSE
)
The format
methods and strftime
return character vectors
representing the time. NA
times are returned as
NA_character_
.
strptime
turns character representations into an object of
class "POSIXlt"
. The time zone is used to set the
isdst
component and to set the "tzone"
attribute if
tz != ""
. If the specified time is invalid (for example
"2010-02-30 08:00") all the components of the result are
NA
. (NB: this does means exactly what it says -- if it is an
invalid time, not just a time that does not exist in some time zone.)
int, unix timestamp value
A character string. The default for the format
methods is
"%Y-%m-%d %H:%M:%S"
if any element has a time
component which is not midnight, and "%Y-%m-%d"
otherwise. If options("digits.secs")
is set, up to
the specified number of digits will be printed for seconds.
A character string specifying the time zone to be used for
the conversion. System-specific (see as.POSIXlt
), but
""
is the current time zone, and "GMT"
is UTC.
Invalid values are most commonly treated as UTC, on some platforms with
a warning.
logical. Should the time zone abbreviation be appended
to the output? This is used in printing times, and more reliable
than using "%Z"
.