Class: Time

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

Instance Method Summary collapse

Instance Method Details

#to_json(options = nil) ⇒ Object



9
10
11
# File 'lib/monkeypatches/time.rb', line 9

def to_json(options = nil)
  %("#{to_json_format}")
end

#to_json_formatObject

returns the time, in UTC, in iso8601 format; see en.wikipedia.org/wiki/ISO_8601 for more details on this format One major advantage of this format over others is that it sorts lexigraphically, so if you want f.e. just stuff from April 2009 you may specify ā€˜2009-04ā€™..ā€˜2009-04Zā€™ as your key



5
6
7
# File 'lib/monkeypatches/time.rb', line 5

def to_json_format
  self.getutc.iso8601
end