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
Write a program in php to print a table of a number?
What are the types of variables in php?
What is the difference between apache vs niginx?
What is regex in html?
Is uploaded file php?
Write a program to find the factorial of a number in php?
What is preg_match?
Which php framework is fastest?
Can a super () and this () keywords be in same constructor?
What is "echo" in php?
What is a substring in php?
What is php session id?
Write a program to find a string is palindrome or not?
What is the default time of cookie in php?
What is get method in java?