<? PHP
Echo "Today:", date ('Y-m-d h: I: s'), "<br> ";
Echo "Tomorrow:", date ('Y-m-d h: I: s', strtotime ('+ 1 Day '));
?>
Current time output from the previous row and tomorrow Time output from the next row
Here + 1 day
You can change Parameter 1 to any desired number of days or change it to year, month, hour, minute, and second)
For example
Date ('Y-m-d h: I: s', strtotime ("+ 1 day + 1 hour + 1 minute ");
Can be freely combined to achieve any output time
Note: This method is intended for trial use after January 1, 1970, that is, the applicable scope of the timestamp.
Common date functions in PHP [date addition and subtraction, difference between two dates, date conversion time cut]
The following code is a common date processing function, which can be used to add or subtract two dates, the difference between two dates, and the date conversion time cut.
Echo date ('Y-m-d', strtotime ('+ 1 d', strtotime ('1970-07-08'); // Date plus Functions
Echo date ("Y-m-d", '20140901 ');
Echo '<br> ';
Echo date ("Y-m-d", '20140901 ');
Die ();
$ D = "10:19:00 ";
Echo date ("Y-m-d", strtotime ("$ D + 1 day"); // Date plus days function
Function datetotime ($ d) // converts a date to a time heap
{
$ Year = (INT) substr ("$ D",); // obtain the year
$ Month = (INT) substr ("$ D", 5, 2); // obtain the month
$ Day = (INT) substr ("$ D", 8, 2); // obtain the number of digits
Return mktime (0, 0, 0, $ month, $ day, $ year );
}
/*
The following function calculates the difference between two dates.
*/
$ Date_1 = "2009-07-08 ";
Echo $ date_1 + 1;
$ Date_2 = "2009-06-08 ";
$ Date_list_a1 = explode ("-", $ date_1 );
$ Date_list_a2 = explode ("-", $ date_2 );
$ D1 = mktime (0, 0, 0, $ date_list_a1 [1], $ date_list_a1 [2], $ date_list_a1 [0]);
$ D2 = mktime (0, 0, 0, $ date_list_a2 [1], $ date_list_a2 [2], $ date_list_a2 [0]);
$ Days = round ($ D1-$ D2)/3600/24 );
Echo "The difference between the two dates is $ Days ";