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
How to get a random value from a php array?
How do you use bcrypt for hashing passwords in php?
How can we set and destroy the cookie in php?
write a note on Testing the web site
Can we run php on tomcat server?
What is the function func_num_args() used for?
Write a select query that will be displayed the duplicated site name and how many times it is duplicated?
Explain what is memcache?
What is is_null() in php?
Explain the value of the variable input is a string 1,2,3,4,5,6,7. How would you get the sum of the integers contained inside input?
What does php exit do?
Explain what are psrs? Choose 1 and briefly describe it?
Tell me what is pear?
Whether php supports microsoft sql server?
What is php destruct?