I have the following syntax :
$today = date("Y-m-d H:i:s");
$modtime = date( "Y-m-d H:i:s", strtotime( $today ) + (2*60 * 60));
I want to add two hours to the current time stamp , but I keep on getting the current time stamp from the above syntax. How can I make it pick the timestamp + 2 hours?
you can add 2 hours like this
$today = date("Y-m-d H:i:s");
strtotime('+2 hours', strtotime( $today ));
you can use strtotime('+2 hours')
. default second parameter is time()
today's timestamp.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.