2 # = parsedate.rb: Parses dates
4 # Author:: Tadayoshi Funaba
5 # Documentation:: Konrad Meyer
7 # ParseDate munches on a date and turns it into an array of values.
11 # ParseDate converts a date into an array of values.
16 # ParseDate.parsedate "Tuesday, July 6th, 2007, 18:35:20 UTC"
17 # # => [2007, 7, 6, 18, 35, 20, "UTC", 2]
19 # The order is of the form [year, month, day of month, hour, minute, second,
20 # timezone, day of the week].
26 # Parse a string representation of a date into values.
31 # ParseDate.parsedate "Tuesday, July 5th, 2007, 18:35:20 UTC"
32 # # => [2007, 7, 5, 18, 35, 20, "UTC", 2]
34 # The order is of the form [year, month, day of month, hour, minute,
35 # second, timezone, day of week].
37 # ParseDate.parsedate can also take a second argument, +comp+, which
38 # is a boolean telling the method to compensate for dates with years
39 # expressed as two digits. Example:
43 # ParseDate.parsedate "Mon Dec 25 00 06:53:24 UTC", true
44 # # => [2000, 12, 25, 6, 53, 24, "UTC", 1]
46 def parsedate(str, comp=false)
47 Date._parse(str, comp).
48 values_at(:year, :mon, :mday, :hour, :min, :sec, :zone, :wday)
51 module_function :parsedate