Page 1 of 1

Add Date,day sun mon

Posted: Fri Nov 26, 2010 3:42 pm
by Scoobs
Im trying to add another day,This is what I have
if (date("D") == "Mon") This works fine
I need it to also have Tue in it,
if (date("D") == "Mon","Tue") will not work
if (date("D") == 'Mon' OR date = 'Tue') will not work
Thanks for any and all help :)

Re: Add Date,day sun mon

Posted: Fri Nov 26, 2010 4:00 pm
by mikecampbell
I've got no idea what exactly you're trying to do, but

Code: Select all

if (date("D") == "Mon","Tue")
is not valid PHP syntax. This might be what you want

Code: Select all

if ((date("D") == "Mon") || (date("D") == "Tue"))
If you want to add one day to a date, you can use the date_add function ( http://www.php.net/manual/en/datetime.add.php ) or something like

Code: Select all

date("D", time()+86400);

Re: Add Date,day sun mon

Posted: Sat Nov 27, 2010 5:42 pm
by Scoobs
That was great help This actually worked in a few lines
if ((date("D") == "Mon") || (date("D") == "Tue"))
Thanks !!!!!
In other lines I had to just change the || to &&
if ((date("D") == "Mon") && (date("D") == "Tue"))
And add the rest of the code ,
Thanks your 1 reply and it worked, Im impressed , and again thanks,
I just taught myself last year on this to create a game, Rather fun to learn something new

Hope this helps others . Big Thanks to mikecampbell

Re: Add Date,day sun mon

Posted: Sat Nov 27, 2010 5:52 pm
by McInfo
Scoobs wrote:In other lines I had to just change the || to &&

Code: Select all

if ((date("D") == "Mon") && (date("D") == "Tue"))
When will it ever be Monday and Tuesday at the same time in one place? That condition will never be true.