On Mon, 02 May 2011 11:46:42 -0500, Matt wrote:

> Have a date:
> 
> 2011-05-02-16:40:51
[...]
> 
> I need to round it to nearest 5 minute point.
> 
> 2011-05-02-16:40:51

If you care about things like daylight savings time adjustments, calendar 
changes, or leap seconds, the answer requires considerably more thought 
(use DateTime and do only one arithmetic operation to adjust the time).  
People who spend much time learning about time peculiarities tend to 
think of those considerations constantly.  They only matter to you if you 
don't want to accidentally generate a time that didn't exist in your 
locale, e.g. 2am on a day that the clocks advanced.

-- 
Peter Scott
http://www.perlmedic.com/     http://www.perldebugged.com/
http://www.informit.com/store/product.aspx?isbn=0137001274
http://www.oreillyschool.com/courses/perl3/

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to