Jump to content

How to Subtract time ???


npsari

Recommended Posts

Hello there,

 

I echo from my database the two variables $time1 & $time2

 

Here is the format of the Time

$time1 = 08:24:02

$time2 = 20:34:47

 

I want to create an IF funtiocn which will echo the following...

 

If the time difference is more than 15 minutes: Sorry, the time difference is more than 15 minutes

If the time difference is less than 15 minutes: Your session is still active

 

But i dont know how to subtract Time

 

$result = $time2 - $time1 ;
If($result > '15') {
Echo "Sorry, the time difference is more than 15 minutes";
}else{
Echo "Your session is still active";
}

 

I think this is wrong... Please show me how...

Link to comment
https://forums.phpfreaks.com/topic/148177-how-to-subtract-time/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.