Learn R Programming

ds4psy (version 0.2.1)

what_time: What time is it?

Description

what_time provides a satisficing version of Sys.time() that is sufficient for most purposes.

Usage

what_time(when = NA, seconds = FALSE, sep = ":")

Arguments

when

Time (as a scalar or vector). Default: when = NA. Returning Sys.time(), if when = NA.

seconds

Boolean: Show time with seconds? Default: seconds = FALSE.

sep

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

Details

what_time returns either a simple version of when or Sys.time() (in " using current system settings.

See Also

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_date(), what_day(), what_month(), what_week(), what_year()

Examples

Run this code
# NOT RUN {
what_time()  

# with vector (of times): 
ts <- c("2020-01-14 01:02:03 CET", "2020-12-31 14:15:16")
what_time(ts)
what_time(ts, seconds = TRUE, sep = "_")

# }

Run the code above in your browser using DataLab