PHP Gets the example of today's early morning timestamp

Source: Internet
Author: User

PHP to get the early morning time stamp, Baidu a bit, did not see there, it may be I understand the wrong.

Directly on the code:

For example, today is November 2, 2102, then PHP to get the November 2, 2102 Timestamp is how to do?

Code: Echo strtotime (' y-m-d '), '

';


Get the time stamp tomorrow morning

Code: Echo strtotime (' y-m-d ', Strtotime (' +1 Day ')), '

';

And finally a string of code

<?php
echo "Today:". Date ("y-m-d"). " <br> ";
echo "Yesterday:". Date ("Y-m-d", Strtotime ("1 day"), "<br>";
echo "Tomorrow:". Date ("Y-m-d", Strtotime ("+1 Day"). " <br> ";
echo "A week later:". Date ("Y-m-d", Strtotime ("+1 Week")). " <br> ";
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")). " <br> ";
echo "Next Monday Four:". Date ("Y-m-d", Strtotime ("next Thursday")). " <br> ";
echo "Last Monday:". Date ("Y-m-d", Strtotime ("Monday")). " <br> ";
echo "One months ago:". Date ("Y-m-d", Strtotime ("last month")). " <br> ";
echo "One months later:". Date ("Y-m-d", Strtotime ("+1 Month")). " <br> ";
echo "Ten years later:". Date ("Y-m-d", Strtotime ("+10 Year")). " <br> ";
The strtotime () function resolves a date-time description to a Unix timestamp
int Strtotime (string time [, int now])
?>

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.