[ create a new paste ] login | about

Link: http://codepad.org/h4AT75x2    [ raw code | output | fork ]

PHP, pasted on Nov 10:
<?php

if (!function_exists('cal_days_in_month')) 
{ 
    function cal_days_in_month($calendar, $month, $year) 
    { 
        return date('t', mktime(0, 0, 0, $month, 1, $year)); 
    } 
} 

if (!defined('CAL_GREGORIAN')) 
    define('CAL_GREGORIAN', 1); 


$days = cal_days_in_month(CAL_GREGORIAN, 9, 2011);

for($i = 0; $i <= $days; $i++)
{
   $MonthlyDate[] = date("Y-m-d", strtotime(2011-09-02) - 86400*$i);
}

print_r($MonthlyDate);


?>


Output:
Array
(
    [0] => 2011-11-10
    [1] => 2011-11-09
    [2] => 2011-11-08
    [3] => 2011-11-07
    [4] => 2011-11-06
    [5] => 2011-11-05
    [6] => 2011-11-04
    [7] => 2011-11-03
    [8] => 2011-11-02
    [9] => 2011-11-01
    [10] => 2011-10-31
    [11] => 2011-10-30
    [12] => 2011-10-29
    [13] => 2011-10-28
    [14] => 2011-10-27
    [15] => 2011-10-26
    [16] => 2011-10-25
    [17] => 2011-10-24
    [18] => 2011-10-23
    [19] => 2011-10-22
    [20] => 2011-10-21
    [21] => 2011-10-20
    [22] => 2011-10-19
    [23] => 2011-10-18
    [24] => 2011-10-17
    [25] => 2011-10-16
    [26] => 2011-10-15
    [27] => 2011-10-14
    [28] => 2011-10-13
    [29] => 2011-10-12
    [30] => 2011-10-11
)


Create a new paste based on this one


Comments: