cur_date
provides a relaxed version of
Sys.time()
that is sufficient for most purposes.
cur_date(rev = FALSE, as_string = TRUE, sep = "-")
Boolean: Reverse from "yyyy-mm-dd" to "dd-mm-yyyy" format?
Default: rev = FALSE
.
Boolean: Return as character string?
Default: as_string = TRUE
.
If as_string = FALSE
, a "Date" object is returned.
Character: Separator to use.
Default: sep = "-"
.
A character string or object of class "Date".
By default, cur_date
returns Sys.Date
as a character string (using current system settings and
sep
for formatting).
If as_string = FALSE
, a "Date" object is returned.
Alternatively, consider using Sys.Date
or Sys.time()
to obtain the "
format according to the ISO 8601 standard.
For more options, see the documentations of the
date
and Sys.Date
functions of base R
and the formatting options for Sys.time()
.
what_date()
function to print dates with more options;
date()
and today()
functions of the lubridate package;
date()
, Sys.Date()
, and Sys.time()
functions of base R.
Other date and time functions:
change_time()
,
change_tz()
,
cur_time()
,
is_leap_year()
,
what_date()
,
what_day()
,
what_month()
,
what_time()
,
what_week()
,
what_year()
# NOT RUN {
cur_date()
cur_date(sep = "/")
cur_date(rev = TRUE)
cur_date(rev = TRUE, sep = ".")
# return a "Date" object:
dt <- cur_date(as_string = FALSE)
class(dt)
# }
Run the code above in your browser using DataLab