PHP DateTime increments, a neater / more efficient way? I'm trying to get to grips with the DateTime class in PHP. Previously I've used date() and mktime() when playing with dates.

Here's the head of a calendar table, and I'm pretty sure I'm doing this in a stupid way! That fact that I'm setting the format each time, and modifying the original date with each Interval, seems 'lumpy': 

&lt;table class="twelve"&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;?php $date = new DateTime('2013-04-01'); ?&gt;
&lt;th style="width:16%"&gt;&lt;?php echo $date-&gt;format('Y'); ?&gt;&lt;/th&gt;
&lt;th style="width:12%"&gt;&lt;?php echo $date-&gt;format('D jS');?&gt;&lt;/th&gt;
&lt;th style="width:12%"&gt;&lt;?php $date-&gt;add(new DateInterval('P1D')); echo $date-&gt;format('D jS');?&gt;&lt;/th&gt;
&lt;th style="width:12%"&gt;&lt;?php $date-&gt;add(new DateInterval('P1D')); echo $date-&gt;format('D jS');?&gt;&lt;/th&gt;
&lt;th style="width:12%"&gt;&lt;?php $date-&gt;add(new DateInterval('P1D')); echo $date-&gt;format('D jS');?&gt;&lt;/th&gt;
&lt;th style="width:12%"&gt;&lt;?php $date-&gt;add(new DateInterval('P1D')); echo $date-&gt;format('D jS');?&gt;&lt;/th&gt;
&lt;th style="width:12%"&gt;&lt;?php $date-&gt;add(new DateInterval('P1D')); echo $date-&gt;format('D jS');?&gt;&lt;/th&gt;
&lt;th style="width:12%"&gt;&lt;?php $date-&gt;add(new DateInterval('P1D')); echo $date-&gt;format('D jS');?&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;/table&gt;


Can anyone point me towards a better way to do this. I'm planning to create a function to spit these calendars out, but I've provided an inline example here so you can see the way I'm using DateTime etc for now.

Thanks
I like it.
You could use loops and use a variable for 'DateInterval(P1D)'.

&lt;table class="twelve"&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;?php $date = new DateTime('2013-04-01'); 
      $day = new DateInterval('P1D');
?&gt;
&lt;th style="width:16%"&gt;&lt;?php echo $date-&gt;format('Y'); ?&gt;&lt;/th&gt;
&lt;th style="width:12%"&gt;&lt;?php echo $date-&gt;format('D jS');?&gt;&lt;/th&gt;
&lt;?php 
for($i = 0;$i &lt;= 6; $i++){
    $date-&gt;add($day)
    echo '&lt;th style="width:12%"&gt;'.$date-&gt;format('D jS').'&lt;/th&gt;';
}?&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;/table&gt;