LoginSignup
0

More than 5 years have passed since last update.

【サルが書く】phpで今日から2週間の日付を出力したい

Last updated at Posted at 2018-01-24

phpで今日を含めた日付を2週間分出力したいって時あるよね!?

そんな要望をピンポイントで書いていきたいと思います。



date_default_timezone_set('Asia/Tokyo');

foreach(range(0,13) as $i){ 
  echo date("Y/m/d", strtotime("+$i day")) . "\n";
};

2018/01/24
2018/01/25
2018/01/26
2018/01/27
2018/01/28
2018/01/29
2018/01/30
2018/01/31
2018/02/01
2018/02/02
2018/02/03
2018/02/04
2018/02/05
2018/02/06

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