The date of the day before or after php. Copy the code as follows :? Phpdate_default_timezone_set (PRC); default time zone echo today:, date (Y-m-d, time (), br; echo today:, date (Y-m-d, strtotime (18june2008), br; e
The code is as follows:
Date_default_timezone_set ('prc'); // Default time zone
Echo "today:", date ("Y-m-d", time ()),"
";
Echo "today:", date ("Y-m-d", strtotime ("18 Jun 2008 ")),"
";
Echo "yesterday:", date ("Y-m-d", strtotime ("-1 day ")),"
";
Echo "tomorrow:", date ("Y-m-d", strtotime ("+ 1 day ")),"
";
Echo "one week later:", date ("Y-m-d", strtotime ("+ 1 week ")),"
";
Echo "one week, two days, four hours, two seconds later:", date ("Y-m-d G: H: s ", strtotime ("+ 1 week 2 days 4 hours 2 seconds ")),"
";
Echo "next Thursday:", date ("Y-m-d", strtotime ("next Thursday ")),"
";
Echo "last Monday:". date ("Y-m-d", strtotime ("last Monday "))."
";
Echo "a month ago:". date ("Y-m-d", strtotime ("last month "))."
";
Echo "one month later:". date ("Y-m-d", strtotime ("+ 1 month "))."
";
Echo "Ten years later:". date ("Y-m-d", strtotime ("+ 10 year "))."
";
?>
Php determines the number of days before a date.
The code is as follows:
Echo (strtotime ('1970-5-20 ')-strtotime (date ("Y-m-d")/2020; then
?>
The http://www.bkjia.com/PHPjc/319056.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/319056.htmlTechArticle code is as follows :? Php date_default_timezone_set ('prc'); // Default time zone echo "today:", date ("Y-m-d", time (), "br "; echo "today:", date ("Y-m-d", strtotime ("18june2008"), "br"; e...