I would like to check the iso8601 format for the date entered in ruby , like start_date = “2011/05/05” should be matched for the format 2011-05-05T00:00:00-04:00 and errors returned accordingly.
Should we use regex here or any method is present for this?
I would like to check the iso8601 format for the date entered in ruby
Share
Sounds like you want
Time.iso8601:See this blog post for more information.
EDIT: Here’s a short but complete test program which works:
Output: