Rounding off time
Posted: Wed Jan 03, 2007 1:50 pm
feyd | Please use
If I keep it to half hour increments, the starting time will always be a good calculation point, but I'll never know what the job duration time is. Somewhere down the line I need to get the job duration to equal a half hour time value before calculating the end of the job and the beginning of the next.
I think I've been looking at this too long!
Thanks,
- dstefani
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello,
I am trying to round off a time value to the nearest half hour or hour.
I am calculating job times that may be anywhere from 1 to 6 hours.
For example a job may spec at 70 minutes long (4200 seconds), to make it to the next half hour I'd take it up to 5400 sec.
These intervals relate to an actual time on a job schedule as job times available.
How would I take any job duration interval and round it to the nearest half hour?Code: Select all
$start_time = '13:00:00'; // 1:00pm
$work_time = 4200; // need to get this to 5400Code: Select all
SELECT SEC_TO_TIME(TIME_TO_SEC('$start_time') + '$work_time') AS 'job_end'I think I've been looking at this too long!
Thanks,
- dstefani
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]