phpstrtotime

PHP - Strtotime - Add hours


I have this variable:

$timestamp = strftime("%Y-%m-%d %h:%M:%S %a", time ());

I simply want to add three hours and echo it out.

I have seen the way where you can do the 60 * 60 * 3 method or the hard code "+ 3 hours" where it understands the words.

What is the best way of getting this result?


Solution

  • $timestamp = strftime("%Y-%m-%d %h:%M:%S %a", time() + 3*60*60)
    

    3*60*60 is the best way