Learn R Programming

ds4psy (version 0.2.0)

what_date: What date is it?

Description

what_date provides a satisficing version of Sys.Date() that is sufficient for most purposes.

Usage

what_date(when = NA, rev = FALSE, sep = "-", month_form = "m")

Arguments

when

Date (as a scalar or vector). Default: when = NA. Using as.Date(when) to convert strings into dates, and Sys.Date(), if when = NA.

rev

Boolean: Reverse date (to Default: rev = FALSE.

sep

Character: Separator to use. Default: sep = "-".

month_form

Character: Month format. Default: month_form = "m" for numeric month (01-12). Use month_form = "b" for short month name and month_form = "B" for full month name (in current locale).

Details

what_date returns either a simple version of when or Sys.Date() (in using current system settings.

See Also

what_day() function to obtain days; what_time() function to obtain times; cur_time() function to print the current time; cur_date() function to print the current date; now() function of the lubridate package; Sys.time() function of base R.

Other date and time functions: cur_date(), cur_time(), what_day(), what_month(), what_time(), what_week(), what_year()

Examples

Run this code
# NOT RUN {
what_date()  
what_date(sep = "/")
what_date(rev = TRUE)
what_date(rev = TRUE, sep = ".")
what_date(rev = TRUE, sep = " ", month_form = "B")

# with vector (of dates):
ds <- c("2020-01-15 01:02:03 CET", "2020-12-31 14:15:16")
what_date(ds)
what_date(ds, rev = TRUE, sep = ".")
what_date(ds, rev = TRUE, month_form = "b")

# }

Run the code above in your browser using DataLab