PHP gets yesterday today's time tomorrow

Source: Internet
Author: User
Tags echo date
PHP

For example, today is November 2, 2102, so what does PHP do to get the timestamp of November 2, 2102?

Code: Echostrtotime (Date (' y-m-d ')), '
';

Get the time stamp tomorrow morning.

Code: Echostrtotime (Date (' y-m-d ', Strtotime (' +1 Day ')), '
';

Attach the test code:

echo strtotime (' 2012-11-2 '), '
';
echo strtotime (' 2012-11-2 00:00:00 '), '
';
Echo strtotime (Date (' y-m-d ')), '
';
echo Date (' y-m-d h:i:s ', Strtotime (date (' y-m-d ')), '
';
Echo strtotime (Date (' y-m-d ', Strtotime (' +1 Day ')), '
';
Echo (Strtotime (Date (' y-m-d ', Strtotime (' +1 Day)))-strtotime (date (' y-m-d '))/3600;


Date_default_timezone_set('PRC'); //Default time zoneEcho"Today:",Date("y-m-d", Time()),"
"; Echo"Today:",Date("y-m-d",Strtotime("June")),"
"; Echo"yesterday:",Date("y-m-d",Strtotime("-1 Day")), "
"; Echo"Tomorrow:",Date("y-m-d",Strtotime("+1 Day")), "
"; Echo"after a week:",Date("y-m-d",Strtotime("+1 Week")), "
"; Echo"2 days a week, four hours, two seconds later:",Date("y-m-d g:h:s",Strtotime("+1 Week 2 days 4 hours 2 seconds")), "
"; Echo"next week four:",Date("y-m-d",Strtotime("next Thursday")), "
"; Echo"Last Monday:".Date("y-m-d",Strtotime("Last Monday"))."
"; Echo"one months ago:".Date("y-m-d",Strtotime("Last month"))."
"; Echo"after one months:".Date("y-m-d",Strtotime("+1 Month"))."
"; Echo"ten years later:".Date("y-m-d",Strtotime("+10 Year"))."
";

The above describes the PHP to get yesterday today's time tomorrow, including aspects of the content, I hope the PHP tutorial interested in a friend helpful.

  • 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.