Class: Time
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.json_create(string) ⇒ Object
7 8 9 10 11 |
# File 'lib/core_ext/time.rb', line 7 def self.json_create string return nil if string.nil? d = DateTime.parse(string).new_offset self.utc(d.year, d.month, d.day, d.hour, d.min, d.sec) end |
Instance Method Details
#to_json(*a) ⇒ Object
2 3 4 5 |
# File 'lib/core_ext/time.rb', line 2 def to_json(*a) self.utc %("#{strftime("%Y/%m/%d %H:%M:%S +0000")}") end |