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?
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()); ?>
echo date("Y-m-d",strtotime("-3 days")).' - '.date("Y-m-d",time());exit();
To dynamically obtain the time range, assign the n value of the last n days to $day
echo date("Y-m-d",strtotime("-3 days")).' - '.date("Y-m-d",time());exit();