Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to count how many sundays in month?

Answer Posted / vinayan

$n=1;
$yy=date("Y");
//$day=strftime("%A");
$day1=getdate(mktime(0,0,0,01,01,$yy));
$day=$day1[weekday];
switch($day)
{

case Sunday:$n=0;
break;
case Monday:$n=$n+6;
break;
case Tuesday:$n=$n+5;;
break;
case Wednesday:$n=$n+4;;
break;
case Thursday:$n=$n+3;;
break;
case Friday:$n=$n+2;;
break;
case Saturday:$n=$n+1;;
break;
}
$yy=date("Y");
$mon=12;
$day=31;
$curyear=$yy."-".$mon."-".$day;
$timeStamp = strtotime($yy."-01-00");
$timeStamp += 24 * 60 * 60 * $n; // (add 7 days)
$newDate = date("Y-m-d", $timeStamp);

Is This Answer Correct ?    21 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are different types of errors available in Php?

978


What is constructor and destructor?

1018


Can php use gettext?

1088


How can I embed a java program in php file and what changes have to be done in php.ini file?

1015


Tell me what is the difference between characters 34 and x34?

1031


Does php 7 support mysql?

1045


What is the difference between query and question?

1014


What does the expression exception::__tostring means?

1061


What is the super method?

1062


Is php used anymore?

1025


Applications written to provide a GUI shell for Unix and Linux are called

1098


Explain Type juggling?

1032


What is the difference between pop3 IMAP and MAPI?

1113


What is the use of super-global arrays in php?

1013


Does php support polymorphism?

994