A typical working day for me starts at 09:00 to 15:00. If a project was to be signed off before or after these hours, how do I calulate the number of hours I have had the signed project for during work hours, based on the sign off date and todays date? Example: Date/Time Now: 20/10/2012 10:00 Date/Time Project Signed: 20/10/2012 07:00 Then the number of working hours I have had the project signed for is 1 hour.
you can make the diference between the days and convert the result in hours and the diference betwheen hours and after this calculate the amount of this 2 results
Do you have any code yet? Here is what I would as per logic: // go through each our number of hours = 0 for x = strtotime(start time); x <= strototime(time now); x += 3600 { // check if this hour is within 9-15 hour = date("H", x) if (hour >= 9 && hour <= 15) { number of hours ++; } } PHP: