Could you tell me how to obtain the date of the day before the specified date? thank you!

Source: Internet
Author: User
Tags echo date
Which expert can obtain the date method of the previous day of the specified date? thank you! Which of the following methods can be used to obtain the date of the specified date, instead of date (& quot; Y-m-d & quot;, strtotime (& quot; -5day & quot;), where "Y-m-d" is to be acquired by a daily master. Which of the following methods can you tell me how to obtain the date from the previous day of the specified date? thank you!
Which of the following methods can be used to obtain the date of a specified date, instead of date ("Y-m-d", strtotime ("-5 day ")), the "Y-m-d" must be replaced by a date value variable. Thank you !!!

------ Solution --------------------
Do you mean that the star format is Y-m-d H: I: s, so you won't use date ("Y-m-d ", strtotime ("-5 day"). if so, format the preceding format using the time function. Use this function. I don't quite understand what the landlord means
------ Solution --------------------
Date ("Y-m-d", strtotime ("-5 day "))
The first five days of today.

So
$ D = '2017-10-2 ';
Echo date ("Y-m-d", strtotime ("-5 day $ d "));

2010-09-27

5 days before?

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.