Class: Time

Inherits:
Object show all
Defined in:
lib/extlib/time.rb

Instance Method Summary collapse

Instance Method Details

#to_datetimeDateTime

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

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

Returns:

  • (DateTime)

    DateTime object representing the same moment as receiver



40
# File 'lib/extlib/time.rb', line 40

remove_method :to_datetime

#to_jsonString

Convert to ISO 8601 representation

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

Returns:

  • (String)

    ISO 8601 compatible representation of the Time object.



15
16
17
# File 'lib/extlib/time.rb', line 15

def to_json(*)
  self.xmlschema.to_json
end

#to_timeTime

Return receiver (for DateTime/Time conversion protocol).

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

Returns:

  • (Time)

    Receiver



27
# File 'lib/extlib/time.rb', line 27

remove_method :to_time