I am coding an application where i need to assign random date between two fixed timestamps
how i can achieve this using php i\'ve searched first but only found the a
By using carbon and php rand between two dates
$startDate = Carbon::now(); $endDate = Carbon::now()->subDays(7); $randomDate = Carbon::createFromTimestamp(rand($endDate->timestamp, $startDate->timestamp))->format('Y-m-d');
OR
$randomDate = Carbon::now()->subDays(rand(0, 7))->format('Y-m-d');