is_valid_date

bidsaid.path_utils.is_valid_date(date_str, date_fmt)[source]

Determine if a string is a valid date based on format.

Parameters

date_strstr

The string to be validated.

date_fmtstr

The expected format of the date.

Return

bool

True if date_str has the format specified by date_fmt.

Example

>>> from bidsaid.metadata import is_valid_date
>>> is_valid_date("241010", "%y%m%d")
    True