Re: Date Issue
| From: | Daniel Brown | Date: | Mon, 31 Mar 2008 20:19:26 +0000 |
| Subject: | Re: Date Issue | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-272352@lists.php.net to get a copy of this message | ||
On Mon, Mar 31, 2008 at 4:15 PM, <admin@buskirkgraphics.com> wrote:
> I tried that a big no go.
> Seems if I do a +1 i get 2 months from now and a -1 gives me the current month.
>
>
>
> $month = date("F", mktime(0,0,0, date('m'), date('d'),
> date('Y')));
> $zomonth = date("F", mktime(0,0,0, date("m")-1, date("d"),
> date("Y")));
> $nmonth = date("F", mktime(0,0,0, date(m)+1, date(d), date("Y")));
>
>
> $month echo's MARCH should be Feb
> $zomonth echo's MARCH should be March
> $nmonth echo's MAY this should be April
That's because you're using today's date('d');, which is 31.
February doesn't have 31 days, nor does April, so mktime() forces
them to the following month to correct the error.
--
</Daniel P. Brown>
Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283