Reputation: 1092
I am new to ruby and i need help to convert a string of format "dd.mm.yyyy" to date time. Thanks in advance!
Upvotes: 3
Views: 3340
Reputation: 15788
Date.strptime('03.02.2001', '%d.%m.%Y')
UPDATE: This will return a Date object
As David rightfully stated below:
DateTime.strptime('03.02.2001', '%d.%m.%Y')
will give you a ruby DateTime object.
Upvotes: 7