The day before yesterday to the interview is also the case, but I did not remember at that time. Remember MYSQL date_sub (now (), 'interval 1 day'); date ('Y / m / dh: i: s', mktime ( date ('h'), date ('i'), date ('s'), date ('m'), date ('d') + 1, date ('Y')));
-------------------------------------------------- ------------------------------ Get today's UNIXTIME Then subtract one or two days from the number of UNIXTIME minus the formatted date. -------------------------------------------------- ------------------------------
The following is quoted content: <? php date_default_timezone_set ('Asia / Shanghai'); #yesterday echo date ("Y / m / dh: i: s", time () - 24 * 60 * 60); echo "<br>"; # The day before yesterday echo date ("Y / m / dh: i: s", time () - 2 * 24 * 60 * 60); ?>
-------------------------------------------------- ------------------------------ up -------------------------------------------------- ------------------------------ There are many ways ah, I also introduce a kind of: date ("Y / m / d H: i: s", strtotime ("1 days ago")); date ("Y / m / d H: i: s", strtotime ("2 days ago")); -------------------------------------------------- ------------------------------ date ("m"), date ("d") - 1, date ("Y"))); -------------------------------------------------- ------------------------------ Previously counted time is always annoying, huh, huh, learned, the following is the next week now time. date_default_timezone_set ('Asia / Shanghai'); $ tmp = time () + 60 * 60 * 24 * 7; print date ("m / d / YH: i: s", $ tmp); -------------------------------------------------- ------------------------------ Add one: $ time_yes = localtime (time () - 24 * 60 * 60, true); $ time_b_yes = localtime (time () - 2 * 24 * 60 * 60, true); $ yesterday = $ time_yes ['tm_mday']; $ the_day_before_yes = $ time_b_yes ['tm_mday']; -------------------------------------------------- ------------------------------ time () - 86400 yesterday
The following is quoted content:
<? //yesterday print date ('Ymd', strtotime ('- 1 day')); //last week print date ('Ymd', strtotime ('- 1 week')); //last month print date ('Ymd', strtotime ('- 1 month')); //last year print date ('Ymd', strtotime ('- 1 year')); ?>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.