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
I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what’s the problem?
What is mysql_fetch_row?
What is sorting php?
Is it easy to learn php?
Explain the visibility of the property or method?
What is final keyword in php?
Explain Whitespace Characters?
What is the use of "ksort" in php?
How should a model be structured in mvc?
How to insert a line break in php string?
What is == and === in php?
Can constructor be private in php?
What are the file upload settings in configuration file?
How to remove leading and trailing spaces from user input values?
What is difference between compile time and run time polymorphism?