Time difference calculation in php/mysql using class&objects

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
satz
Forum Newbie
Posts: 3
Joined: Wed Apr 16, 2008 7:11 am

Time difference calculation in php/mysql using class&objects

Post by satz »

Hi Everybody.... I have been facing the problem of calculating time difference for past two days....i wil feel happy if somebody comes with a suggestion for it.... login time is entered in hh:ss form in one form selecting from drop down and store in db... when retrieving it in another form for calculating time difference i am facing a prob in splitting it and calculating the time difference... if both the login & logout time which is selected thru dropdown are in same form then on clicking the hour textbox the time is calculated & shown...
Last edited by John Cartwright on Wed Apr 16, 2008 9:08 am, edited 1 time in total.
Reason: Why did you bold your entire post!?
ianhull
Forum Contributor
Posts: 310
Joined: Tue Jun 14, 2005 10:04 am
Location: Hull England UK

Re: Time difference calculation in php/mysql using class&objects

Post by ianhull »

you could explode the value of timeField

Code: Select all

 
 
$timeSplit = explode(':', '$timeFromDB');
 
$hour = $timeSplit[0];
$seconds = $timeSplit[1];
 
//do you other stuff
 
 
Post Reply