I want to implement a function. For example, if I want to get the time of the last 3 days, I will pass parameter 3 and return a string of 2017-06-18 - 2017-06-20. What should I do?
大家讲道理2017-06-21 10:13:21
To dynamically obtain the time range, assign the n value of the last n days to $day
<?php
$day = 3;
echo date("Y-m-d",strtotime("-".$day." days")).' - '.date("Y-m-d",time());
?>
滿天的星座2017-06-21 10:13:21
echo date("Y-m-d",strtotime("-3 days")).' - '.date("Y-m-d",time());exit();