class DateTime
Constants
- DAY_SECONDS
Public Class Methods
local(year, month, day, hour = 0, minute = 0, second = 0)
click to toggle source
# File lib/dohutil/core_ext/date.rb, line 23 def self.local(year, month, day, hour = 0, minute = 0, second = 0) Time.local(year, month, day, hour, minute, second).to_datetime end
seconds_to_days(seconds)
click to toggle source
# File lib/dohutil/core_ext/datewithtime.rb, line 15 def self.seconds_to_days(seconds) seconds.to_f / DAY_SECONDS.to_f end
zow()
click to toggle source
# File lib/dohutil/core_ext/datewithtime.rb, line 7 def self.zow now.zowify end
Public Instance Methods
inspect()
click to toggle source
# File lib/dohutil/core_ext/inspect.rb, line 13 def inspect "#<DateTime:#{strftime('%F %X %z')}>" end
next_second(n = 1)
click to toggle source
# File lib/dohutil/core_ext/datewithtime.rb, line 19 def next_second(n = 1) self + self.class.seconds_to_days(n) end
prev_second(n = 1)
click to toggle source
# File lib/dohutil/core_ext/datewithtime.rb, line 23 def prev_second(n = 1) next_second(-n) end
sub_dt(other)
click to toggle source
subtract another DateTime
object, return difference in seconds
# File lib/dohutil/core_ext/datewithtime.rb, line 28 def sub_dt(other) ((self - other) * DAY_SECONDS).to_i end
to_display()
click to toggle source
# File lib/dohutil/to_display.rb, line 10 def to_display strftime('%m/%d/%Y %I:%M%P') end
zowify()
click to toggle source
# File lib/dohutil/core_ext/datewithtime.rb, line 11 def zowify self.class.new(year, month, mday, hour, min, sec, 0) end