for($date){ ($h,$m,$s)=split/:/; s/\:\d\d$//; #throw out the seconds, we don't need them $m="00" if ($m<15); $m="15" if (($m>=15) && ($m<30)); $m="30" if (($m>=30) && ($m<45)); $m="45" if ($m>=45); s/\:\d\d\/\:$m/; #replace the minutes with the generalized value }