// 特定の2つの日付の例
$start = Carbon::create("2015", "1", "1");
$end = Carbon::create("2020", "12", "31");
// タイムスタンプに変換
$min = strtotime($start);
$max = strtotime($end);
// タイムスタンプにした2つの日付の中からランダムに1つタイムスタンプを取得
$date = rand($min, $max);
// タイムスタンプ => Y-m-d に変換
$date = date('Y-m-d', $date)
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme