|
Posted by Rik on 09/28/05 11:48
ivan wrote:
> 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" ?
date() will make a string, which you cast to an integer (1) by subtracting
an integer. I am not capable of testing it right now, I suspect it will
return 0.
Try:
date("m',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
Which will first make a current timestamp, and return 12 if performed in
january
Grtz,
--
Rik Wasmus
Navigation:
[Reply to this message]
|