Advertisement
killerbng

Print out Dates for 1 year

Aug 25th, 2015
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.22 KB | None | 0 0
  1. <?php
  2. $from = new DateTime("01/01/2015");
  3. $to = new DateTime('01/01/2016');
  4. //Print Jan 1st through Dec 31st
  5. for($date=clone $from; $date<$to; $date->modify('+1 day')){
  6.     echo $date->format('Y-m-d')."<br />".PHP_EOL;
  7. }
  8. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement