When analyzing "some dates" (in Ruby), c Time.strptimeand Date.strptimehave a different behavior.
For example, if we try to convert “February 30” (a date that does not exist), we have:
Time.strptime('30 Feb 2015', '%d %b %Y')
Date.strptime('30 Feb 2015', '%d %b %Y')
At the same time, an attempt to analyze February 32 leads to an error for both classes.
Time.strptime('32 Feb 2015', '%d %b %Y')
Date.strptime('32 Feb 2015', '%d %b %Y')
What is the reason for the different behavior? Why is Time "trying to set" an invalid date?
source
share