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 list in PHP?
What are the uses of implode() function?
What is the role of php.ini file?
what is variable scope, which variables are accessible from where and what are "undefined variable" errors?
Why is used in php?
Which function would you use to replace a record in a database in php?
How do you put a space in html?
What is the use of dual table in mysql?
Which functions are used to count the total number of array elements in php?
What is final class and final method in php?
What is mvc in php?
How can you get the size of an image in PHP?
What is reference variable php?
What is xss and csrf?
What is printf in php?