require 'parsedate' include ParseDate # Include parsedate() as a global function datestring = "2001-01-01" values = parsedate(datestring) # [2001, 1, 1, nil, nil, nil, nil, nil] t = Time.local(*values) # => Mon Jan 01 00:00:00 -0800 2001 s = t.ctime # => "Mon Jan 1 00:00:00 2001" Time.local(*parsedate(s))==t # => true