Page 1 of 1

select month

Posted: Fri May 05, 2006 1:34 am
by itsmani1
date("F j, Y, ");

gives me

March 10, 2001

what if i want to select last month? means the month before March

Posted: Fri May 05, 2006 1:38 am
by someberry

Posted: Fri May 05, 2006 3:01 am
by timvw
http://www.php.net/strtotime can be useful to..

Posted: Fri May 05, 2006 3:42 am
by JayBird
Something like this

Code: Select all

echo date("F", strtotime("last month"));

Posted: Fri May 05, 2006 3:46 am
by dibyendrah
Hope you are looking for this thing :

Code: Select all

<?php
$m = date('m');
$d = date('d');
$y = date('y');
echo date("M-d-Y", mktime(0, 0, 0, $m-1, $d, $y));
?>