Trying to sort dates
Posted: Sun Jul 15, 2007 11:36 am
What I want to do is simple but I just cant get it to work
I have six event dates that I want to list on the page and distinguish when events have passed.
It is almost working like this but I would like to have the months but that did not work?
Showing the "Next" event would also be nice!
I have six event dates that I want to list on the page and distinguish when events have passed.
It is almost working like this but I would like to have the months but that did not work?
Showing the "Next" event would also be nice!
Code: Select all
<?php
//put event show dates here...
$date_1 = "5 13, 2007"; //first show
$date_2 = "6 24, 2007"; //next show
$date_3 = "7 15, 2007"; // ect...
$date_4 = "8 5, 2007";
$date_5 = "9 30, 2007";
$date_6 = "10 14, 2007";
$today = date("n d, Y"); // 10 21, 2007
if ($date_1 < $today) {echo "<span class=\"style1\">$date_1 - past</span><br />"; } else { echo "<b>$date_1</b><br />"; }
if ($date_2 < $today) {echo "<span class=\"style1\">$date_2 - past</span><br />"; } else { echo "<b>$date_2</b><br />"; }
if ($date_3 < $today) {echo "<span class=\"style1\">$date_3 - past</span><br />"; } else { echo "<b>$date_3</b><br />"; }
if ($date_4 < $today) {echo "<span class=\"style1\">$date_4 - past</span><br />"; } else { echo "<b>$date_4</b><br />"; }
if ($date_5 < $today) {echo "<span class=\"style1\">$date_5 - past</span><br />"; } else { echo "<b>$date_5</b><br />"; }
if ($date_6 < $today) {echo "<span class=\"style1\">$date_6 - past</span><br />"; } else { echo "<b>$date_6</b><br />"; }
?>