AlkantarClanX12
Current Path : /opt/alt/ruby18/share/ri/1.8/system/Time/ |
Current File : //opt/alt/ruby18/share/ri/1.8/system/Time/parse-c.yaml |
--- !ruby/object:RI::MethodDescription aliases: [] block_params: (year) comment: - !ruby/struct:SM::Flow::P body: Parses <tt>date</tt> using Date._parse and converts it to a Time object. - !ruby/struct:SM::Flow::P body: "If a block is given, the year described in <tt>date</tt> is converted by the block. For example:" - !ruby/struct:SM::Flow::VERB body: " Time.parse(...) {|y| y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}\n" - !ruby/struct:SM::Flow::P body: "If the upper components of the given time are broken or missing, they are supplied with those of <tt>now</tt>. For the lower components, the minimum values (1 or 0) are assumed if broken or missing. For example:" - !ruby/struct:SM::Flow::VERB body: " # Suppose it is "Thu Nov 29 14:33:20 GMT 2001" now and\n # your timezone is GMT:\n Time.parse("16:30") #=> Thu Nov 29 16:30:00 GMT 2001\n Time.parse("7/23") #=> Mon Jul 23 00:00:00 GMT 2001\n Time.parse("Aug 31") #=> Fri Aug 31 00:00:00 GMT 2001\n" - !ruby/struct:SM::Flow::P body: "Since there are numerous conflicts among locally defined timezone abbreviations all over the world, this method is not made to understand all of them. For example, the abbreviation "CST" is used variously as:" - !ruby/struct:SM::Flow::VERB body: " -06:00 in America/Chicago,\n -05:00 in America/Havana,\n +08:00 in Asia/Harbin,\n +09:30 in Australia/Darwin,\n +10:30 in Australia/Adelaide,\n etc.\n" - !ruby/struct:SM::Flow::P body: Based on the fact, this method only understands the timezone abbreviations described in RFC 822 and the system timezone, in the order named. (i.e. a definition in RFC 822 overrides the system timezone definition.) The system timezone is taken from <tt>Time.local(year, 1, 1).zone</tt> and <tt>Time.local(year, 7, 1).zone</tt>. If the extracted timezone abbreviation does not match any of them, it is ignored and the given time is regarded as a local time. - !ruby/struct:SM::Flow::P body: ArgumentError is raised if Date._parse cannot extract information from <tt>date</tt> or Time class cannot represent specified date. - !ruby/struct:SM::Flow::P body: "This method can be used as fail-safe for other parsing methods as:" - !ruby/struct:SM::Flow::VERB body: " Time.rfc2822(date) rescue Time.parse(date)\n Time.httpdate(date) rescue Time.parse(date)\n Time.xmlschema(date) rescue Time.parse(date)\n" - !ruby/struct:SM::Flow::P body: A failure for Time.parse should be checked, though. full_name: Time::parse is_singleton: true name: parse params: (date, now=self.now) {|year| ...} visibility: public