Time Difference Question

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
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Time Difference Question

Post by tecktalkcm0391 »

Ok, I have a timestamp of the time the user last changed pages. I have and AJAX script doing a check and I want the PHP page its going to do find the time difference between the current time and the last changed page time and if its greater than 20 minutes to run the Javascript Function. What would I do on the page the AJAX script checks?
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

Convert last changed to a timestamp and test it against time();
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

I mean like logic wise?

Code: Select all

if( Last Changed - Current Time < 5 mins ){

}
Cause I cant get that to work... :(
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Current time - Change time < X minutes.
Post Reply