How to add time to php timestamp: First create a PHP sample file; then increase the current timestamp by one year through the "strtotime(" 1 year");" method; and finally output the increased result That’s it.
Recommended: "PHP Video Tutorial"
php current timestamp increase time
php adds one year to the current timestamp
echo strtotime(" 1 year");//Return the timestamp, if you want to convert it to a general time format You also need the following function
echo date('Y-m-d H:i:s', strtotime("+1 year"));
Similarly, it can not only be year, but also day, month and day. The following code:
<?php echo strtotime("now"), "\n"; echo strtotime("10 September 2000"), "\n"; echo strtotime("+1 day"), "\n"; echo strtotime("+1 week"), "\n"; echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\n"; echo strtotime("next Thursday"), "\n"; echo strtotime("last Monday"), "\n"; ?>
The above is the detailed content of How to add time to php timestamp. For more information, please follow other related articles on the PHP Chinese website!