how to count how many sundays in month?
Answer Posted / ashish kumar
/* $day = 0 for counting sunday. If you want to count
any other day in a month then set the $day accordingly.
For example $day = 3 for wednesday
*/
$day = 0;
$temp = date('j') - date('w') + $day ;
$count_day_in_a_month = (int)($temp/7) + (int)((date('t') -
$temp)/7) + 1;
| Is This Answer Correct ? | 13 Yes | 10 No |
Post New Answer View All Answers
What is mvc in php?
Explain preg_Match and preg_replace?
What are session variables in php?
Explain what does the expression exception::__tostring means?
Is php a middleware?
Explain about a search-friendly site looks like?
Why use static methods php?
What is alias in php?
Explain how you can update memcached when you make changes to php?
How to join multiple strings into a single string?
Explain me what are the 3 scope levels available in php and how would you define them?
What is difference between session and cookies in php?
Tell me what is the use of explode() function?
How do I make a reset button in html?
Which MySQL function would you use to select a database?