Jump to content

[SOLVED] Why doesn't this work?


Siggles

Recommended Posts

<?php

$now = date('Y-m-d');

if ($now > date('2007-12-06') AND $now < date('2007-12-09')) {

echo "Luton (A)<br />

Saturday, 8 December 2007";

} elseif($now > date('2007-12-09') AND $now < date('2007-15-09')) {

echo "Oldham (H)<br />

Saturday, 15 December 2007";

}else {

echo "End of season";

}

?>

 

I got this short script working with the unix timestamp but it was too long to edit so have tried to change it to just using the date as above but now it goes striaght to the last else.

Link to comment
Share on other sites

use the strtotime function instead

 

<?php
$now = time();
if ($now > strtotime('2007-12-06') AND $now < strtotime('2007-12-09')) 
{
   echo "Luton (A) Saturday, 8 December 2007";
} 
elseif($now > strtotime('2007-12-09') AND $now < strtotime('2007-15-09')) 
{
   echo "Oldham (H) Saturday, 15 December 2007";
}
else {
   echo "End of season";
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.