PHP deals with time it uses only one measurement, seconds. Once we know how time works in PHP, it becomes easier to add, subtract, and calculate time. Below is a quick guide:
Time in Seconds
1 Minute: 60 seconds
1 Hour: 3,600 seconds
1 Day: 86,400 seconds
1 Week: 604,800 seconds
4 Weeks: 2,419,200 seconds
1 Year: 31,536,000 seconds
1 Decade: 315,360,000 seconds
Now let’s put this into practice. Let’s say for example you wanted to set a cookie in a user’s browser to expire in one year. The way we would calculate this is by adding one year, or 31,536,000 seconds to the current date .
$Year = 31536000 + time() ;