Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i get the current month and previous three months using PHP

Tags:

Will any one tell me how to get the current month and previous three months using PHP

For example:

echo date("y:M:d");

output will be: 09:Oct:20

But i need:

August

September

October

as the Output.

Thanks in advance...

Fero

like image 276
Fero Avatar asked Oct 20 '09 12:10

Fero


1 Answers

for full textual representation of month you need to pass "F":

echo date("y:F:d");

for previous month you can use

echo date("y:F:d",strtotime("-1 Months"));

like image 198
Deniss Kozlovs Avatar answered Nov 12 '22 04:11

Deniss Kozlovs