payal_suthar payal_suthar - 6 months ago 19
jQuery Question

To display dates continuously in a table column automatically

Friends, how can I display dates as like in calendar in a single column in a table?
And it should be for the entire year continuous.I have searched a lot and have not found anything related.Please help me out.
Thanks in advance.

Answer

You can use this code:

<?php
    $year = 2016;
    $months = array(1,2,3,4,5,6,7,8,9,10,11,12);

    foreach($months as $month)
    {
        $totalDays = cal_days_in_month(CAL_GREGORIAN, $month, $year);
        for($i=1; $i<= $totalDays; $i++)
        {
            echo date('l',strtotime(date("$year-$month-$i"))).'=>'.date("$year-$month-$i").'<br/>';

        }
    }
?>