Skip to content

Instantly share code, notes, and snippets.

@odlp
Created August 28, 2014 14:22
Show Gist options
  • Save odlp/19d750af7d185bb1bd74 to your computer and use it in GitHub Desktop.
Save odlp/19d750af7d185bb1bd74 to your computer and use it in GitHub Desktop.
ISO8601 string
def iso8601_string? datetime_str
(datetime_str =~ /\A\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)\z/) == 0
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment