Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAbirbhav Goswami
15,450 PointsIRB shows wrong date
I tried tinkering around with the dates, and I found that it gives me a year of 2020 every time I strptime it as "%d/%m/%y":
Date.strptime("13/2/2016", "%d/%m/%y")
gives output of:
=> #<Date: 2020-02-13 ((2458893j,0s,0n),+0s,2299161j)>
I tried another example here:
irb(main):005:0> Date.strptime("13/2/2012", "%d/%m/%y")
This too gives output:
=> #<Date: 2020-02-13 ((2458893j,0s,0n),+0s,2299161j)>
1 Answer
Kourosh Raeen
23,733 PointsCapitalize y as in:
Date.strptime("13/2/2016", "%d/%m/%Y")
Abirbhav Goswami
15,450 PointsAbirbhav Goswami
15,450 PointsThanks!