Pick up time can only choose two days after the order of time, how to write with PHP?
At present, the problem is that each month is not necessarily 31 days, and if the number of goods 30th, to choose the next month's time, this will be increased processing it? Thank you, guys.
Reply content:
Pick up time can only choose two days after the order of time, how to write with PHP?
At present, the problem is that each month is not necessarily 31 days, and if the number of goods 30th, to choose the next month's time, this will be increased processing it? Thank you, guys.
date('Y-m-d H:i:s',strtotime('+2 days'));
A different idea,
How many zodiac do you care for one months? Just use the time stamp to judge, right?
First Date +2
Then judge the month separately, note the February and leap years
Recent Python-written code for reference only
c_day += 2if ( c_day == 29 and c_month == 2 and not is_leap_year ) \ or ( c_day == 30 and c_month == 2 ) \ or ( c_day == 31 and (c_month == 4 or c_month == 6 or c_month == 9 or c_month == 11) ) \ or ( c_day == 32 and (c_month == 1 or c_month == 3 or c_month == 5 or c_month == 7 or c_month == 8 or c_month == 10) ) \ or ( c_day == 32 and c_month == 12 ): if c_day == 32 and c_month == 12: #when 12 year should increase c_year += 1 c_month = 1 is_leap_year = (c_year%400 == 0 or (c_year%4 == 0 and c_year%100 )) else: c_month += 1 c_day = 1
http://cn2.php.net/manual/zh/class.datetime.php
$dateTime = new DateTime("now",new DateTimeZone("Asia/Chongqing"));$dateTime->modify("+2 day");echo $dateTime->format("Y-m-d");