date ("m") question
am 24.05.2006 11:55:49 von ivan
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.
--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-
Re: date ("m") question
am 24.05.2006 13:39:11 von Rik
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" ?
1. If you want to post to several newsgroups, crosspost, don't multipost.
2. Answered in alt.php
3. If you're going to perform calculations with it, your string will be cast
to an integer, so you might as wel use date("n").
Grtz,
--
Rik Wasmus
Re: date ("m") question
am 25.05.2006 01:22:28 von nc
ivan wrote:
>
> 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" ?
0. If you want the previous month, you need to use something like
this:
date('m', strtotime ('-1 month'));
Cheers,
NC