how to extract month from given date by using string
functions?
Answers were Sorted based on User's Feedback
Answer / guest
print strftime('%B',time());
This will return the name of the current month.
And date('M') also will return current month.
If you want to get month from the date then use the
following way.
$date=date('d/M/Y')
$date=substr($date,strpos($date,'/')+1);
$date=substr($date,0,strpos($date,'/'));
Finally $date will contain the month name.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / 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 |
use this code.
[code]
?php
print date ( 'm',mktime ( 0,0,0,02,26,2010 ) ) ;
?>
~
[/code]
| Is This Answer Correct ? | 0 Yes | 3 No |
What is new keyword in php?
how can i get USA time using php...
What is the purpose of the following files having extensions 1) .frm 2) .myd 3) .myi? What do these files contain?
What are the two most common ways to start and finish a php block of code?
how to do connectivity of 2 dbs in PHP script?
How do sessions work in php?
Whether site will complete the execution of the script if Fatal error occurs ?
How to download a php script directly in your script page?
3 Answers A1 Technology, Zmanda,
How can we get the error when there is a problem to upload a file?
Tell me how do you define a constant?
I created a new joomla module for administrator. when am going to install this, it is going "joomla/modules" path. but, i want to install this in the "joomla/administration/modules" path.
What is is_null() in php?