A question about time

Source: Internet
Author: User
For a time issue, the current date is obtained through the control: PHPcode $ thisday =$ _ GET ['calendar']; now I want to calculate the day before the date (the day before the calendar date ), how can this problem be solved? Note: The calendar string format is Y-m-d,-1day, echodate ('Y-m-D', strtotime (& q a question about time
The current date is obtained through the control:
PHP code
  $ Thisday = $ _ GET ['Calendar '];

Now I want to find the day before this date (the day before the calendar date). how can I find it?

Note: The string form of the calendar is Y-m-d.

------ Solution --------------------
-1day
------ Solution --------------------
Echo date ('Y-m-D', strtotime ("-1 day $ thisday "));
------ Solution --------------------
If the time format of $ _ GET ['Calendar '] is similar to "11:56:30", it is first converted to the time format: strtotime ($ _ GET ['Calendar'])
Then subtract the number of seconds in a day: strtotime ($ _ GET ['Calendar '])-60*60*24

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.