Class: Time
- Inherits:
-
Object
- Object
- Time
- Defined in:
- lib/couch_potato/core_ext/time.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.json_create(string) ⇒ Object
12 13 14 15 16 |
# File 'lib/couch_potato/core_ext/time.rb', line 12 def self.json_create string return nil if string.nil? d = DateTime.parse(string.to_s).new_offset self.utc(d.year, d.month, d.day, d.hour, d.min, d.sec).in_time_zone end |
Instance Method Details
#as_json(*args) ⇒ Object
8 9 10 |
# File 'lib/couch_potato/core_ext/time.rb', line 8 def as_json(*args) getutc.strftime("%Y/%m/%d %H:%M:%S +0000") end |
#to_json(*a) ⇒ Object
4 5 6 |
# File 'lib/couch_potato/core_ext/time.rb', line 4 def to_json(*a) %("#{as_json}") end |