is_iso_datetime: Check if an argument is an ISO 8601 datetime string

View source: R/string.R

is_iso_datetimeR Documentation

Check if an argument is an ISO 8601 datetime string

Description

Validates the YYYY-MM-DDTHH:MM:SS[.sss] format with calendar correctness, including leap year handling. The timezone designator is optional and can be Z or an offset like +05:30.

Usage

is_iso_datetime(x)

Arguments

x

(any)
Object to check.

Value

TRUE if x is a valid ISO 8601 datetime string, FALSE otherwise.

References

https://en.wikipedia.org/wiki/ISO_8601

Examples

is_iso_datetime("2024-01-15T12:00:00Z")
is_iso_datetime("2024-01-15T12:00:00+05:30")
is_iso_datetime("2024-01-15T12:00:00")

checkstring documentation built on Sept. 28, 2026, 5:07 p.m.