1 //set China time zone2Date_default_timezone_set (' PRC ');3 //today's time to rub4 $today _start=Strtotime(Date(' y-m-d ', Time()).‘ 0:0:0 ');5 $today _end=Strtotime(Date(' y-m-d ', Time()).‘ 23:59:59 ');6 //the time stamp of yesterday7 $yesterday _start=Strtotime('-1 day '. ') 0:0:0 ');8 $yesterday _end=Strtotime('-1 day '. ') 23:59:59 ');9 //View last month's dateTen $first _day_of_month=Date(' Y-m ', Time()).‘ -01 00:00:01 '; One $t=Strtotime($first _day_of_month); A Date(' Y-m ',$t); - Date(' Y-m ',Strtotime('-1 month ',$t)); - Date(' Y-m ',Strtotime('-2 month ',$t)); the - //Get time stamp - method One: - $yesterday _s=Mktime(0,0,0,Date(' m '),Date(' d ')-1,Date(' Y '));//the time of yesterday started rubbing + $yesterday _e=Mktime(23,59,59,Date(' m '),Date(' d ')-1,Date(' Y '));//the time of yesterday's end rubs - + $tenday _s=Mktime(0,0,0,Date(' m '),Date(' d ')-10,Date(' Y '));//timestamp started 10 days ago A $tenday _e=Mktime(23,59,59,Date(' m '),Date(' d ')-10,Date(' Y '));//timestamp ended 10 days ago at - //Method two: - $yesterday _s=Strtotime(Date("Y-m-d",Strtotime(" -10 Day"). ' 0:0:0 ');//timestamp started 10 days ago - $yesterday _e=Strtotime(Date("Y-m-d",Strtotime(" -10 Day"). ' 23:59:59 ');//timestamp ended 10 days ago - - //Method Three: in $day=$_request[' Day '];//date required for statistics - $time _s=Strtotime($day.‘ 0:0:0 '); to $time _e=Strtotime($day.‘ 23:59:59 '); + - //Get the timestamp for this Monday the Strtotime(Date("Y-m-d",Strtotime("-1 week Monday"))); * $ //get today start timestamp and end timestampPanax Notoginseng $beginToday=Mktime(0,0,0,Date(' m '),Date(' d '),Date(' Y ')); - $endToday=Mktime(0,0,0,Date(' m '),Date(' d ') +1,Date(' Y ')) -1; the + //get yesterday start timestamp and end timestamp A $beginYesterday=Mktime(0,0,0,Date(' m '),Date(' d ')-1,Date(' Y ')); the $endYesterday=Mktime(0,0,0,Date(' m '),Date(' d '),Date(' Y ')) -1; + - //get the start timestamp and end timestamp for the week $ $beginThisweek=Mktime(0,0,0,Date(' m '),Date(' d ')-Date(' W ') +1,Date(' Y ')); $ $endThisweek= Time(); - - //get last week start timestamp and end timestamp the $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 ')); Wuyi the //get this month start timestamp and end timestamp - $beginThismonth=Mktime(0,0,0,Date(' m '), 1,Date(' Y ')); Wu $endThismonth=Mktime(23,59,59,Date(' m '),Date(' t '),Date(' Y ')); - About //last month's start time: $ $begin _time=Strtotime(Date(' y-m-01 00:00:00 ',Strtotime('-1 month ')))); - $end _time=Strtotime(Date("Y-m-d 23:59:59",Strtotime(-Date(' d '). ' Day))); - - $begin _year=Strtotime(Date("Y", Time())." -1 "." -1 ");//starting this year A $end _year=Strtotime(Date("Y", Time())." -12 "." -31 ");//End of year + the //Current time to the next morning time stamp of difference - $time= (Strtotime(Date(' y-m-d ')) +3600*24)- Time() ;
PHP time stamp common conversions