How would I go about doing a customized ROUND function, but instead of using 5 and 6 to round up or down, using 7 and 8?
I am using times and want to round to the nearest quarter-hr, but use if =<7 round down to neartest quarter hr, and if =>8 round UP to nearest quarter hour.
I converted all the times in my MySQL table to 24 hr format to solve certain problems.
so I have
T1=03:07:00 (3:07am)
T2=15:08:00 (3:08pm)
T3=15:24:00 (3:24pm)
I want to round these to nearest quarter hr based on 7 and 8 (minutes).
and I want them to be:
T1=03:00:00 (3:00am)
T2=15:15:00 (3:15pm)
T3=15:30:00 (3:30pm)
(I have it all seperated so its not a time stamp, just numbers.. Its a complete custom time system)
{the following data passed into an array from a form)
$Hours1 = 03 ;
$Minutes1 = 07 ;
$Seconds1 = 00 ;
$Hours2 = 15 ;
$Minutes2 = 08 ;
$Seconds2 = 00 ;
$Hours3 = 16 ;
$Minutes3 = 24 ;
$Seconds3 = 00 ;
{Code to do custom rounds on $Minutes1 and $Minutes2
so that Minutes1 = 00, $Minutes2 = 15, $Minutes3 = 30, etc..)
$Time1 = $Hours1.":".$Minutes1.":".$Seconds1;
$Time2 = $Hours2.":".$Minutes2.":".$Seconds2;
$Time3 = $Hours3.":".$Minutes3.":".$Seconds3;
{Insert into MySQL table Time, fields Time1, Time2, and Time3}
Thanx for any help you can offer.
-Matt