Class Time
In: lib/extlib/time.rb
Parent: Object
Time dot/f_26.png

Methods

Public Instance methods

Convert to DateTime (for DateTime/Time conversion protocol).

  Time.now.to_datetime    #=> #<DateTime: 106046956823/43200,-1/3,2299161>

@return [DateTime] DateTime object representing the same moment as receiver

@api public

[Source]

    # File lib/extlib/time.rb, line 38
38:   def to_datetime
39:     DateTime.parse self.to_s
40:   end

Convert to ISO 8601 representation

  Time.now.to_json        #=> "\"2008-03-28T17:54:20-05:00\""

@return [String]

  ISO 8601 compatible representation of the Time object.

@api public

[Source]

    # File lib/extlib/time.rb, line 14
14:   def to_json(*)
15:     self.xmlschema.to_json
16:   end

Return receiver (for DateTime/Time conversion protocol).

  Time.now.to_time        #=> Wed Nov 19 20:08:28 -0800 2008

@return [Time] Receiver

@api public

[Source]

    # File lib/extlib/time.rb, line 26
26:   def to_time
27:     self
28:   end

[Validate]