Class: Time

Class | Time
In: | rss/rss.rb
Parent: | Object

### Methods

w3cdtf

### External Aliases

iso8601 | -> | w3cdtf

### Public Class methods

w3cdtf(date)

[Source]

    # File rss/rss.rb, line 6
          def w3cdtf(date)
            if /\A\s*
                (-?\d+)-(\d\d)-(\d\d)
                (?:T
                (\d\d):(\d\d)(?::(\d\d))?
                (\.\d+)?
                (Z|[+-]\d\d:\d\d)?)?
                \s*\z/ix =~ date and (($5 and $8) or (!$5 and !$8))
              datetime = [$1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i, $6.to_i]
              datetime << $7.to_f * 1000000 if $7
              if $8
                Time.utc(*datetime) - zone_offset($8)
              else
                Time.local(*datetime)
              end
            else
              raise ArgumentError.new("invalid date: #{date.inspect}")
            end
          end

[Validate]