PHP Compute Time

Source: Internet
Author: User

<?phpechoDate' Y-m-d h:i:s ',Time ());Running results (month, day and minute, "-" interval): 2014-09-12 06:28:32echoDate' Y-m-d ',Time ());Run result (year, month, "-" interval): 2014-09-12echoDate' Y-m-d ',Strtotime (Date' Y-m-d ',Time ()-86400)));Run result (day of the month before the current date, "-" interval): 2014-09-11echoDate' Ymd ',Time ());Results of operation (year Month day, no interval): 20140912echoDate' M-d ',Time ());Run result (Month day, "-" interval): 09-12echoStr_replace ("-","Month",Date' M-d ',Time ()-date (' W ',Time ()) *86400)). " Day ";Running results (Month day, kanji display interval): September 12 EchoDate' W ',Time ());Running results (days of the week): 5echotime (); //run result (seconds of current datetime): 1410503809echo strtotime (date ( ' y-m-d ', time ()));  Run result (current date seconds, specific to day): 1410503809echo date ( ' y-m-d ', strtotime (date ( ' Y-m-d ', time ())) -date ( ' W ', strtotime (date ( ' Y-m-d ', time ()))) *86400); //run result (the date of the natural week to which the current date belongs is Sunday, specific to day, "-" interval): 2014-09-07       
PHP gets today's start timestamp and end timestamp$beginToday =mktime (0,0,0,Date' m '),Date' d '),Date' Y '));$endToday =mktime (0,0,0,Date' m '),Date' d ') +1,Date' Y '))-1;PHP gets yesterday start timestamp and end timestamp$beginYesterday =mktime (0,0,0,Date' m '),Date' d ')-1,Date' Y '));$endYesterday =mktime (0,0,0,Date' m '),Date' d '),Date' Y '))-1;PHP gets last week start timestamp and end timestamp$beginLastweek =mktime (0,0,0,Date' m '),Date' d ')-Date' W ') +1-7,Date' Y '));$endLastweek =mktime (23,59,59,Date' m '),Date' d ')-Date ' W ') +7-7, date ( ' Y ')); //php get this month start timestamp and end timestamp  $beginThismonth =mktime (0,0,0,date (1,date (  $endThismonth =mktime (23,59,< Span class= "Hljs-number" >59,date ( ' m '), date ( ' t '), date (             
<?php/**date 2015-04-11 * Author http://www.lai18.com **/EchoDate"Ymd", Strtotime ("Now")),"\ n"; EchoDate"Ymd", Strtotime ("-1 week Monday")),"\ n"; EchoDate"Ymd", Strtotime ("-1 week Sunday")),"\ n"; EchoDate"Ymd", Strtotime ("+0 Week Monday")),"\ n"; EchoDate"Ymd", Strtotime ("+0 Week Sunday")),"\ n"; Echo"*********:" In the first few months; EchoDate' n '); Echo"********* Week of the week:"; EchoDate"W"); Echo"********* Days of the Month:"; EchoDate"T"); Echo"*********"; Echo' <br>:<br> ' at the start of last week; EchoDate"Y-m-d h:i:s", Mktime (0,0,0,Date"M"),Date"D")-Date"W") +1-7,Date"Y")),"\ n"; EchoDate"Y-m-d h:i:s", Mktime (23,59,59,Date"M"),Date"D")-Date"W") +7-7,Date"Y")),"\ n"; Echo' <br> start time:<br> '; EchoDate"Y-m-d h:i:s", Mktime (0,0,0,Date"M"),Date"D")-Date"W") +1,Date"Y")),"\ n"; EchoDate"Y-m-d h:i:s", Mktime (23,59,59,Date"M"),Date"D")-Date"W") +7,Date"Y")),"\ n"; Echo' <br> last month start time:<br> '; EchoDate"Y-m-d h:i:s", Mktime (0,0,0,Date"M")-1,1,Date"Y")),"\ n"; EchoDate"Y-m-d h:i:s", Mktime (23,59,59,Date"M"),0,Date"Y")),"\ n"; Echo' <br> start time:<br> '; EchoDate"Y-m-d h:i:s", Mktime (0,0,0,Date"M"),1,Date"Y")),"\ n"; EchoDate"Y-m-d h:i:s", Mktime (23,59,59,Date"M"),Date"T"),Date"Y")),"\ n";$season =Ceil ((Date' n '))/3);The month is the first quarter of the Echo' <br> this quarter start time:<br> '; EchoDate' Y-m-d h:i:s ', Mktime (0,0,0,$season*3-3 +1,1,Date' Y ')),"\ n"; EchoDate' Y-m-d h:i:s ', Mktime (23,59,59,$season,Date' t ', mktime (0,0,0,$season,1,Date"Y")),Date' Y ')),"\ n";$season =Ceil ((Date' n '))/3)-1;Last quarter was the first quarter of the Echo' <br> last quarter start time:<br> '; EchoDate' Y-m-d h:i:s ', Mktime (0,0,0, $season *3-3+ 1,1,date ( date ( ' y-m-d h:i:s ', mktime (23,59, 59, $season *3,date (0,  0, 0, $season *3,1,date (" Y ")))      

PHP Calculation time

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.