how to count no. of hours and minutes in two set of time. having a start time to end time.

1st time : 8:00 to 17:00
2nd time : 9:00 to 18:00
answer : 6hrs <- total number of time

(-) number of hours
(|) start/end

|--------| = 8hrs
|--------| = 8hrs
|------| = 6hrs <- total number of time

like this.

6 Years
Discussion Span
Last Post by RCrizt

where ur starttime endtime stored?
In mysql or you want calculation in php

Edited by urtrivedi: n/a


i am developing a time keeping system. i have night diffirental start and end time and a actual time of employee in and out. :3


can u precisely tell what is ur requriment, means what you will input to php and what output is expected from it. Why mysql is not there in picture.

Edited by urtrivedi: n/a


thanks for the respond. i cannot really explain it. but i made a picture than hopefully explain it well, (im not good in english) :3

using only php script. i want to create a four text box, in first two box i want to input a start time and 2nd is end time, for the third one is to input another start time and end time for the last textbox. then a submit button.

when all box have a value, submit the form and show how many hour(s) or minutes the two time have same time. like you will see in my drawing.... hehehe :P

Attachments z.gif 11.57 KB

i am try'n now to convert a
$time1_start = strtotime("mm/dd/yyyy h:m");
$time1_end = strtotime("mm/dd/yyyy h:m");

$time2_start = strtotime("mm/dd/yyyy h:m");
$time2_end = strtotime("mm/dd/yyyy h:m");

then try to capture the time that they have the same.
but for now i really dont know how??? hehehe..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.