I am drawing a bar graph and the values on the x-axis are the months in the last one year period. For example, this is March 2014; so the values on the x-axis range from April 2013 to March 2014 which is the current month.
I am using echo date('M');
to print the current month and echo date('M', strtotime(' -1 month'));
and echo date('M', strtotime(' -2 month'));
and so on to get all previous months.
These have been working fine until today, 29th March.
Where 'Feb' is supposed to be is also printing 'Mar'. I figure it is because February has 28 days.
Is there an easy fix to this without having to use if... else
statements or if... else
shorthand statements on all echo
statements telling it to echo date('M', strtotime('-n month 2 days'));
?