timestap_dt_str {oaii}R Documentation

Convert unix timestamp to formated date/time string

Description

Convert unix timestamp to formated date/time string

Usage

timestap_dt_str(
  timestamp,
  format = "%Y-%m-%d %H:%M:%S",
  tz = "",
  usetz = FALSE
)

Arguments

timestamp

int, unix timestamp value

format

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.

tz

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.

usetz

logical. Should the time zone abbreviation be appended to the output? This is used in printing times, and more reliable than using "%Z".

Value

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.)


[Package oaii version 0.5.0 Index]