how to count how many sundays in month?
Answer Posted / koushikgraj
function total_sundays($month,$year)
{
$sundays=0;
$total_days=cal_days_in_month(CAL_GREGORIAN, $month, $year);
for($i=1;$i<=$total_days;$i++)
if(date('N',strtotime($year.'-'.$month.'-'.$i))==7)
$sundays++;
return $sundays;
}
echo total_sundays(1,2011);
| Is This Answer Correct ? | 45 Yes | 9 No |
Post New Answer View All Answers
What is the timeout period on session values?
How can image properties be retrieved in php?
What is the use of the function htmlentities?
What is the use of inner join in mysql?
Is it possible to use com component in php?
How cookies are transported from servers to browsers?
Is php a web server?
How to create a mysql connection?
Can we learn php without html?
How do you measure variables?
What exactly is PHP?
What are the benefits of using php?
What is the use of addslashes in php?
What is cookie and session in php?
Explain setcookie() function in php?