Am am current facing a problem that need a solution ASAP.
I am trying to list all months of the current year(2012) by using the following code:
for ($m=1; $m<=12; $m++) {
$month = date('F', mktime(0,0,0,$m));
echo $month. '<br>';
}
But am getting the following unexpected output:
January March March May May July July August October October December December
What am I doing wrong please help!!!
Months are same for every year
I guess you should loop it in this manner.
Or in your case, you want to use mktime()
Try this:
Set
day
inmktime()
to1
, otherwise conversion is performed:30.2.2012 = 1.3.2012
Pay attention to the localization.
You can also use this
Changing the parameter on the function setlocale() you can display the localized text.
list of setlocale codes