Jump to content

Recommended Posts

how to calculate the difference between the current datetime  from the stored one(ie date_field = 2020-08-09 23:13:06) in order to compare with 15min, i mean  if the resulted time exceed 15 min and not the same day(date) the provided link will show  expire message.

i.e $some_variable = $date_in_db - current_date;

if((time() - $some_variable > 15*60) && not the same day or the same day){

echo 'the link has expired';

}

 

Link to comment
https://forums.phpfreaks.com/topic/311301-datetime-calculation-in-php/
Share on other sites

8 hours ago, gw1500se said:

You need to use strtotime. It will create a time stamp then you compare the time stamps directly.


if(strtotime("+15 minutes") < strtotime($some_variable)) {

 

 

8 hours ago, gw1500se said:

You need to use strtotime. It will create a time stamp then you compare the time stamps directly.


if(strtotime("+15 minutes") < strtotime($some_variable)) {

 

what if user click the link by tomorrow at the same time

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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