Module: DateTimeExtensions

Defined in:
lib/ruby_extensions.rb

Instance Method Summary collapse

Instance Method Details

#round(granularity = 1.hour) ⇒ Object



72
73
74
# File 'lib/ruby_extensions.rb', line 72

def round(granularity = 1.hour)
  Time.at((to_time.to_i / granularity).round * granularity).to_datetime
end