Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

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

Why php is used in html?

173


How to access a Static Member of a Class in PHP?

201


Write the statements that are used to connect php with mysql

184


Is php difficult to learn?

154


/temp is a type of filesystem directory. State Whether True or False?

199






What is the function of trim?

153


What is xss in php?

179


Tell me what is the actually used php version?

217


What are php magic quotes?

156


How to reset/destroy a cookie in php?

181


Explain what is memcache?

150


What are the ways to define a constant in php?

169


What is the use of htmlentities in php?

156


When sessions ends?

187


What is difference between required and require_once in php?

158