validate_iso8601_strings#
- validate_iso8601_strings(time_strings, has_ms=None, has_tz=None)#
- Validate if collection of strings all are ISO8601.
Also verify if timestamps includes milliseconds and timezone.
- Parameters:
- time_strings: 1D array-like of strings
collection of timestrings to be validated
- has_ms: bool
Test if strings include milliseconds
- has_tz: bool
Test if strings include timezone
- Returns:
- are_valid: bool
True if all strings in collection are ISO8601 timestamps including ms and excluding timezone. False otherwise
See also
Examples
>>> time_strings = ['2021-01-09T17:47:56.154564', '2021-05-09T17:47:56.13'] >>> pystare.validate_iso8601_strings(time_strings, has_ms=True, has_tz=False) True >>> time_strings = ['2021-01-09T17:47:56.154564', '2021-05-09T17:47:51'] >>> pystare.validate_iso8601_strings(time_strings, has_ms=True, has_tz=False) False