As above, use the strptime method, but note the differences below
Date.strptime("12/22/2011", "%m/%d/%Y") => Thu, 22 Dec 2011 DateTime.strptime("12/22/2011", "%m/%d/%Y") => Thu, 22 Dec 2011 00:00:00 +0000 Time.strptime("12/22/2011", "%m/%d/%Y") => 2011-12-22 00:00:00 +0000
(+0000 is the time zone information, and I'm now in GMT - hence +0000. Last week, before the clock returned, I was in BST +0100. My application.rb contains the line config.time_zone = 'London' )
Mitch Oct 28 '13 at 9:23 2013-10-28 21:23
source share