View source: R/utils-datetime.R
duration2datetime | R Documentation |
Convert duration to date-time Convert a string with a duration (e.g. 'an hour ago') to a date-time string, based on a reference time
duration2datetime(
str,
ref_time = Sys.time(),
output_format = "%Y-%m-%d %H:%M:%S %Z"
)
str |
String with a duration (see examples) |
ref_time |
Reference time (default: |
output_format |
String with the format of the output (default:
|
Date-time object based on the input string, str
, and the reference
time ref_time
.
duration2datetime("a minute ago")
duration2datetime("an hour ago")
duration2datetime("a day ago")
duration2datetime("a week ago")
duration2datetime("a month ago")
duration2datetime("a year ago")
duration2datetime("2 minutes ago")
duration2datetime("2 hours ago")
duration2datetime("2 days ago")
duration2datetime("2 weeks ago")
duration2datetime("2 months ago")
duration2datetime("2 years ago")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.