Posted by : Anjana Jayaweera Tuesday, March 26, 2013

Extracted from PHP.net

function days_in_month($month, $year)  { 
return $month == 2 ? 
($year % 4 ? 28 : ($year % 100 ? 29 : ($year % 400 ? 28 : 29))) : 
(($month - 1) % 7 % 2 ? 30 : 31); 
}

echo days_in_month(YOUR_MONTH,YOUR_YEAR);


More Simple way by a SafFunction

function days_in_month($month,$year) {
return date('t',mktime(0,0,0,$month,1,$year));
}

echo days_in_month(YOUR_MONTH,YOUR_YEAR);

{ 1 comments... read them below or add one }

  1. Oh my dear it is toooooo loang,
    I just have very small one.

    $days_in_month = date('t',mktime(0,0,0,$month,1,$year));

    print $days_in_month;

    ReplyDelete

Popular Post

Blogger templates

Labels

- Copyright © My Code Genius by 2 Geniuses -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -