LoginSignup
0
0

More than 1 year has passed since last update.

日付を取得する方法

Last updated at Posted at 2022-03-22

・日付を取得する方法
コード

<?php
date_default_timezone_set('Asia/Tokyo');
for ($i = 0; $i < 366; $i++) {
    $time = strtotime('+' . $i . ' day');
    $day = date('n/j(D)', $time);
    echo $day . '<br>';
}

strtotime('+' . $i . ' day')
文字列を$i日後の時間に変換

$day = date('n/j(D)', $time)
月/日(曜日)の形で$timeの日付を$dayに代入

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0