Re: Date Issue

From: Date: Mon, 31 Mar 2008 20:25:11 +0000
Subject: Re: Date Issue
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-272356@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 > > You will notice i used all options apostrophes double quotes and no quotes exactly the same > output. > > > > > > > > You need apostrophes (or quotes) around your args to date() in the > parameters... > > date('m') > > As it stands now, PHP assumes you mean the constant m > (http://php.net/define) and that's not defined, so they are all 0. > > So you are passing in 0 to ALL the args. > > You also should use E_ALL for your error_reporting so you would SEE > the error messages telling you about this. > Just to clarify -- Richard's response fixes a poor coding practice in your original post, but it does not "fix" the problem that you originally asked about. Andrew

« previous php.general (#272356) next »