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 extract month from given date by using string
functions?

Answer Posted / subodh

Assume date is like $datestr = '01-12-2013';
then it can be below two ways:
1. echo date('M', strtotime($datestr)); // for textual
// Or date('m', strtotime($datestr)); // for numeric
2. $list($d, $m, $y) = explode('-', $datestr);
echo $m; // for numeric

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what’s the problem?

999


What is mysql_fetch_row?

1106


What is sorting php?

993


Is it easy to learn php?

1027


Explain the visibility of the property or method?

1071


What is final keyword in php?

1119


Explain Whitespace Characters?

1105


What is the use of "ksort" in php?

985


How should a model be structured in mvc?

992


How to insert a line break in php string?

1045


What is == and === in php?

956


Can constructor be private in php?

1087


What are the file upload settings in configuration file?

1092


How to remove leading and trailing spaces from user input values?

1023


What is difference between compile time and run time polymorphism?

1057