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


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.

Recommended Answers

All 6 Replies

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

in php only,

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.

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

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..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.