class String
def to_datetime
"2012-12-13 12:50".to_datetime # => Thu, 13 Dec 2012 12:50:00 +0000
"01/01/2012 23:59:59".to_datetime # => Sun, 01 Jan 2012 23:59:59 +0000
"1-1-2012".to_datetime # => Sun, 01 Jan 2012 00:00:00 +0000
Converts a string to a DateTime value.
def to_datetime ::DateTime.parse(self, false) unless blank? end