Hey guys... Date and time related stuff is probably my biggest weakness with PHP, but I have a fairly simple problem maybe one of you can help me with.
I am making a part of a webpage that is a conditional that will do something if the current date is October of 2007 or later. So basically, I want to write some code for the page right now, so that when it does turn October, the page displays something different.
Any idea on the best way to do this? Any guidance would be greatly appreciated. Thanks.
Date specific conditional
Moderator: General Moderators
- seodevhead
- Forum Regular
- Posts: 705
- Joined: Sat Oct 08, 2005 8:18 pm
- Location: Windermere, FL
- mikeeeeeeey
- Forum Contributor
- Posts: 130
- Joined: Mon Jul 03, 2006 4:17 am
- Location: Huddersfield, UK
basically it's just an if statement, with the condition being the date...
hope it helps
Code: Select all
if(date("F") == "October"){
//execute code for october
}else{
//execute code for not being october
}- seodevhead
- Forum Regular
- Posts: 705
- Joined: Sat Oct 08, 2005 8:18 pm
- Location: Windermere, FL
Not the best at dates either but would something like this work:
Wayne
Code: Select all
if((date("F") >= "October") && (date("Y") >= "2007")){
//execute code for october 07 or >
}else{
//execute code for not being october
}- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Code: Select all
if (time() > strtotime('October 2007'))
{
}- seodevhead
- Forum Regular
- Posts: 705
- Joined: Sat Oct 08, 2005 8:18 pm
- Location: Windermere, FL