How to round a time down to the nearest 15 minutes in Ruby?
Posted
by Readonly
on Stack Overflow
See other posts from Stack Overflow
or by Readonly
Published on 2009-01-16T01:59:33Z
Indexed on
2010/04/13
22:43 UTC
Read the original article
Hit count: 122
ruby
Is there an easy way to round a Time down to the nearest 15 minutes?
This is what I'm currently doing. Is there an easier way to do it?
t = Time.new
rounded_t = Time.local(t.year, t.month, t.day, t.hour, t.min/15*15)
© Stack Overflow or respective owner