Have a date:

2011-05-02-16:40:51

Using this to get it:

$tm = gmtime;
$time_stamp = sprintf "%04d-%02d-%02d-%02d:%02d:%02d",
 $tm->year + 1900, $tm->mon + 1, $tm->mday, $tm->hour, $tm->min, $tm->sec;
print "$time_stamp\n";

I need to round it to nearest 5 minute point.

2011-05-02-16:40:51

needs rounded like so.

2011-05-02-16:00:00
2011-05-02-16:45:00
2011-05-02-16:50:00
2011-05-02-16:55:00

My thought is a bunch of if statements but that seems ugly.  Is there
a better/easier way?

-- 
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