Re: [PHP] Date Issue



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.

On Mon, March 31, 2008 2:07 pm, admin@xxxxxxxxxxxxxxxxxxx wrote:
Not understanding why this is happening.

$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)));

echoing out the exact same month
March
March

Checked server timezone/date/time all is good. Am I half asleep at the
wheel on this one and just not seeing my mistake here?


Richard L. Buskirk

Hardware Failure: $4,000.
Network Outage: $15,000.
Always blaming the programmers for everything: Priceless.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?
.



Relevant Pages

  • Re: [PHP] Date Issue
    ... $zomonth echo's MARCH should be March ... You will notice i used all options apostrophes double quotes and no quotes exactly the same output. ... So you are passing in 0 to ALL the args. ...
    (php.general)
  • Re: [PHP] Date Issue
    ... You will notice i used all options apostrophes double quotes and no quotes ... PHP General Mailing List ... "Build a man a fire, and he will be warm for the rest of the day. ...
    (php.general)
  • Re: [RFC] Re: Parsing kernel parameters and escaping "
    ... wasn't possible to escape quotes or use quotes to form space-filled ... we've never had the ability to escape quotes (and you're the first to ... static unsigned int pull_token(char *args, const char *delim) ...
    (Linux-Kernel)
  • Re: [RFC] Re: Parsing kernel parameters and escaping "
    ... Attempt to handle quotes in kernel parameters ... There was a limitation for kernel parameters with regards to quoting. ... +/* modifies args with handled quotes ... +int printf; ...
    (Linux-Kernel)
  • Re: XP problem with command line arguments with spaces
    ... In window 2000 and before I did not have a problem. ... Typically you would put quotes around a long name to force it to be ... 2K/XP command prompts are long name aware so do not need the ... application but will pass any args without mangling them whether they ...
    (microsoft.public.vb.general.discussion)