Home>Article>Backend Development> How to get the time in a few days in php
php method to get the time in a few days: first create a PHP sample file; then use "date("Y-m-d H:i:s",strtotime("3 day"));" to get the time in 3 days Time is enough.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
php method to get the time and date after N days
Example 1: php gets the time and date after 3 days
Code:
Output result:
2019-11-07 23:23:25 2019-11-10 23:23:25
Example 2: php gets the time after n days Date function
Function code:
Function call:
Supplementary instructions:
Flexibly use PHP’s strtotime(), you can also get The time and date are N hours before, N hours after, one week ago, one month after, etc. of the current time.
Example:
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to get the time in a few days in php. For more information, please follow other related articles on the PHP Chinese website!