Learn R Programming

stppSim (version 1.3.4)

date_checker: Date (Format) Checker

Description

Checks if date is in a specified format (i.e. 'yyyy-mm-dd').

Usage

date_checker(x)

Value

Returns TRUE or FALSE

Arguments

x

A date or a vector of date values

Details

Returns "TRUE" if all date entries are in the specified format ("yyyy-mm-dd), and FALSE if at least one date is not in the format.

Examples

Run this code
date_list_1 <- c("2021-09-12", "2016-xx-02",
"09/08/2012")
date_checker(date_list_1)
#> FALSE (Entries 2 and 3
#are incorrect date inputs)
date_list_2 <- c("2021-09-12", "1998-03-09")
date_checker(date_list_2)
#> TRUE

Run the code above in your browser using DataLab