Use PHP to get the details of the time today tomorrow time stamp yesterday

Source: Internet
Author: User
Tags echo date

Use PHP to get the time today tomorrow yesterday time stamp 2013-06-20 11:12<?phpecho "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 "One week later:". Date ("Y-m-d", Strtotime ("+1 Week")). "     <br> "; echo "2 days a week four hours two seconds after:". Date ("Y-m-d g:h:s", Strtotime ("+1 Week 2 Day 4 hours 2 Seconds")). "     <br> "; echo "Next week Four:". Date ("Y-m-d", Strtotime ("next Thursday")). "     <br> "; echo "Previous Monday:". Date ("Y-m-d", Strtotime ("Last 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 function of the Strtotime () function is to parse the datetime description into the unix timestamp int strtotime (string time [, int now])?> This function expects to accept a string containing the U.S. English date format and attempt to resolve it to Unix time Stamp (number of seconds from January 1 1970 00:00:00 GMT) whose value is relative to the time given by the now parameter, if this parameter is not provided, the current time of the system. -------------------------------------------------------------------in PHP get the day before andThe code of yesterday's date was the same as the day before the interview, but I couldn't remember. Just remember that date_sub (now (), ' Interval 1 days ') in MySQL;d ate (' y/m/d h:i:s ', mktime (date (' H '), Date (' I '), date (' s '), date (' m '), date (' d ') +1, date (' Y ')),-------------------------------------------------------- ------------------------get today's unixtime and subtract a day or a two-day number of seconds to format the reduced unixtime as a date. --------------------------------------------------------------------------------the following references: <?php date_default_ Timezone_set (' Asia/shanghai '); #昨天 echo Date ("Y/m/d h:i:s", Time () -24*60*60); echo "<br>"; #前天 echo Date ("Y/m/d h:i:s", Time () -2*24*60*60)?>------------------------------------------------------------- There are many ways to-------------------up--------------------------------------------------------------------------------. I also introduce a bar: Date ("Y/m/d h:i:s", Strtotime ("1 days Ago"); Date ("Y/m/d h:i:s", Strtotime ("2 days Ago"); --------------------------------------------------------------------------------date ("Y/m/d h:i:s", Mktime (0,0,0 , date ("M"), Date ("D") -1,date ("Y"))); --------------------------------------------------------------------------------before the time is always very annoying, hehe, learning, the following is the time of next week now. Date_default_timezone_set (' Asia/shanghai '); $tmp = time () +60*60*24*7; Print date ("m/d/y h: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 the content of the quote: &LT;? Yesterday print date (' y-m-d ', Strtotime ('-1 day ')); Last week print date (' y-m-d ', Strtotime ('-1 week ')); Last month print date (' y-m-d ', Strtotime ('-1 month ')); Last Print date (' y-m-d ', Strtotime ('-1 year '));?>-------------------------------------------------------------- ------------------Strtotime get a timestamp and then you format it yourself. Strtotime (' Yesterday '); Strtotime ('-2 day ');

  

Use PHP to get the details of the time today tomorrow time stamp yesterday

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.