Ruby/Date/parse
Материал из Wiki.crossplatform.ru
Date.parse
require "date" puts Date.parse("2/9/2007").to_s puts Date.parse("Wednesday, January 10, 2001").to_s
Date.parse(")
require "date" puts Date.parse("2/9/07").to_s # => "0007-02-09"
Parsing Times and Dates
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