|
Posted by robert on 09/28/84 11:48
"ivan" <pc@moosewebdesign.com> wrote in message
news:BWVcg.443815$ze.11832446@phobos.telenet-ops.be...
| Hello,
|
| just one small question concerning 'previous month':
|
| the function date ("m") gives me the current month.
|
| So, date("m")-1 returns the previous month.
|
| But, if the current month is "01", will this return "12" or "00" ?
|
| Tx,
| Ivan.
ivan, you'll get into all sorts of nasty stuff doing "date math" that way.
try this:
$thisMonth = strtotime(date('m') . '/01/' . date('Y'));
$lastMonth = strtotime('-1 month', $thisMonth);
$nextMonth = strtotime('+1 month', $thisMonth);
print_r(
array(
'this month: ' => date('m', $thisMonth) ,
'last month: ' => date('m', $lastMonth) ,
'next month: ' => date('m', $nextMonth)
)
);
hth,
me
Navigation:
[Reply to this message]
|