Jump to content

does this mean 30 mins?


Danny620

Recommended Posts

Your question needs to be more in depth. 30 minutes in what? Minutes, seconds, hours?

 

The function time() returns a Unix timestamp (which is in seconds) calculated using the date January 1 1970 00:00:00 GMT as described at http://php.net/time

 

To add 30 minutes to the current time (if that's what you're looking to do) you need to calculate 30 minutes in seconds as your Unix timestamp is in seconds. Whilst this is not compulsory, I would argue its the most logical way of doing it else you'll be converting one timestamp to another form and it gets over complicated.

 

Moreover, if you want an expiration time you shouldn't be subtracting time you should be adding time to generate a time in the future. Therefore the calculation you need (provided you want an expiration Unix timestamp with a period of 30 minutes) is:

 

$expires = time() + (60*30);

 

60 seconds to a minute and you want 30 minutes worth of seconds added to the current time.

Link to comment
Share on other sites

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.