PHP uses the date and Strtotime functions to output a specified date method, Datestrtotime
This example describes how PHP uses date and strtotime functions to output a specified date. Share to everyone for your reference. The specific methods are analyzed as follows:
In PHP, the date and Strtotime functions are operations on dates, but in the generation above date and strtotime are not the same, one is the number date one is the Unix timestamp, but we can all generate the same date, the following two examples of functions.
PHP often uses the date function and the Strtotime function, these 2 functions are not unfamiliar to everyone, today and we share the use of skills.
strtotime-to parse the datetime description of any English text into a Unix timestamp
Copy the Code code as follows: Date_default_timezone_set (' Asia/shanghai ');
To calculate the time of yesterday, we used:
Date ("Ymd", Time ()-3600);
Generate yesterday's time
Date ("Ymd", Strtotime (' Yesterday '));
Date ("Ymd", Strtotime ('-1 day '));
Generate time the day before
Date ("Ymd", Strtotime (' Yesterday-1 Day '));
Date ("Ymd", Strtotime ('-2 day '));
Time after 3 days of generation
Date ("Ymd", Strtotime (' +3 Day '));
Generated one months ago
Date ("Ymd", Strtotime ('-1 month '));
Generate the time of the last day of next month
Date ("Ymd", Strtotime (' Last day of next month '));
Monday of next week
Date ("Ymd", Strtotime (' next Monday '));
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/911908.html www.bkjia.com true http://www.bkjia.com/PHPjc/911908.html techarticle PHP uses the date and Strtotime functions to output a method of specifying a date, Datestrtotime This example describes how PHP uses date and strtotime functions to output a specified date. Share for everyone to join us ...