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.

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.