This article mainly share with you the use of PHP timestamp, this article is mainly in the form of code and we share, hope to help everyone. 
 
$date = Date (' y-m-d ', Time ());//Today "2018-3-1"//php get today start timestamp and end timestamp $start = mktime (0, 0, 0, date (' m '), date (' d '), date (' Y ') ); $end = mktime (0, 0, 0, date (' m '), date (' d ') + 1, date (' Y '))-1; resolves the English text datetime to a Unix timestamp: Echo (Strtotime ("Now"). "<br>"), Echo (Strtotime ("October 1980"). "<br>"), Echo (Strtotime ("+5 hours"). "<br>"), Echo (Strtotime ("+1 Week"). "<br>"), Echo (Strtotime ("+1 Week 3 days 7 hours 5 Seconds"). "<br>"), Echo (Strtotime ("Next Monday"). "<br>"); Echo (Strtotime ("Last Sunday"));
 
$type = $param [' type '];switch ($type) {case 3: {//month $start = mktime (0, 0, 0, date (' m '), 1, date (' Y '));    $end = mktime (0, 0, 0, date (' m '), date (' d ') + 1, date (' Y '));        };    Break        Case 6: {//last month $start = mktime (0, 0, 0, date (' m ')-1, 1, date (' Y '));    $end = mktime (0, 0, 0, date (' m '), 1, date (' Y '))-1;        };    Break        Case 7: {//this week $start = mktime (0, 0, 0, date (' m '), date (' d ')-date (' W '), date (' Y '));    $end = mktime (0, 0, 0, date (' m '), date (' d '), date (' Y '));        };    Break        Case 8: {//last week $start = mktime (0, 0, 0, date (' m '), date (' d ')-7-date (' W '), date (' Y '));    $end = mktime (0, 0, 0, date (' m '), date (' d ')-date (' W '), date (' Y '))-1;        };    Break        Case 4: {//this year $start = mktime (0, 0, 0, 1, 1, date (' Y '));    $end = mktime (0, 0, 0, 1, 1, date (' Y ') + 1);        };    Break        Case 5: {//Yesterday $start = mktime (0, 0, 0, date (' m '), date (' d ')-1, date (' Y ')); $end = mktime (0, 0, 0, date (' m '), date (' d '), date (' Y '))-1;        };    Break        Case 9: {//First seven days $start = mktime (0, 0, 0, date (' m '), date (' d ')-6, date (' Y '));    $end = mktime (Date (' H '), date (' m '), date (' s '), date (' m '), date (' d '), date (' Y '));        };    Break        Case 2: {//First 30 days $start = mktime (0, 0, 0, date (' m '), date (' d ')-, date (' Y '));    $end = mktime (Date (' H '), date (' m '), date (' s '), date (' m '), date (' d '), date (' Y '));        };    Break        Case 1: {//Today $start = mktime (0, 0, 0, date (' m '), date (' d '), date (' Y '));    $end = mktime (0, 0, 0, date (' m '), date (' d ') + 1, date (' Y '))-1;        };    Break    Default: {return '; }} 
Using $end and $start as a Where condition
 
Use the date () method to fetch only the month and date of the current time, but when you query the time format from the database, the method cannot be obtained, for example: date ("D", $time);
But using date () can get to date ("Y", $time), date ("M", $time), date ("D", $time), but if you want to get the current date, we can use the two-time split function
You can do it!
 
<?php  //time of year  $strtimes = $info [datetime]  $strtimes = Explode ("", $strtime);  $timearray = Explode ("-", $strtimes [0]);  $year = $timearray [0];  $month = $timearray [1];  $day = $timearray [2];    ? >
 
Related recommendations:
 
PHP timestamp and date conversion instance sharing
 
Summary of PHP timestamp function usage
 
PHP timestamp using instance Code _php tutorial