Method: DateTime.parse
- Defined in:
- lib/date.rb
.parse(str = '-4712-01-01T00:00:00+00:00', comp = false, sg = ITALY) ⇒ Object
Create a new DateTime object by parsing from a String, without specifying the format.
str is a String holding a date-time representation. comp specifies whether to interpret 2-digit years as 19XX (>= 69) or 20XX (< 69); the default is not to. The method will attempt to parse a date-time from the String using various heuristics; see #_parse in date/format.rb for more details. If parsing fails, an ArgumentError will be raised.
The default str is ‘-4712-01-01T00:00:00+00:00’; this is Julian Day Number day 0.
sg specifies the Day of Calendar Reform.
1581 1582 1583 1584 |
# File 'lib/date.rb', line 1581 def self.parse(str='-4712-01-01T00:00:00+00:00', comp=false, sg=ITALY) elem = _parse(str, comp) new_by_frags(elem, sg) end |