1, first through Strtotime () to obtain the date timestamp
2, get the time stamp N days ago, through the "current timestamp-n days of the number of seconds = n days before the time stamp"
3, to n days before the time stamp with the date () function for format conversion
The following example: Date of the day before the 2012-5-1 number was obtained
Copy the Code code as follows:
Convert a point in time to a timestamp
$date = Strtotime (' 2012-5-1 ');
Output the date of the day, minus the number of seconds in a day on the timestamp
echo Date (' y-m-d ', $date -1*24*60*60);
?>
Output: 2012-4-30
In addition, the time () function gets the timestamp of the current date!
http://www.bkjia.com/PHPjc/324668.html www.bkjia.com true http://www.bkjia.com/PHPjc/324668.html techarticle 1, first through the strtotime () to obtain a date timestamp 2, get n days before the time stamp, through the "current timestamp-n days of the number of seconds = n days before the time stamp" 3, to n days before the time stamp with da ...