Thread: Php Automation
View Single Post
Old Aug 18th, 2004, 4:59 PM   #3
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
Here goes nothing:

<?PHP

function compair($date1, $date2, $date3)
{
    //all dates must be unix timestamps.
    //date1 is the current date.
    //date2 is the starting date of a period
    //date3 is the ending date of a period.
    if ($date1 >= $date2 && $date1 <= $date3)
    {
          return true;
     }
     else
     {
          return false;
     }
}

$mydate = date("m.d.y");
list($month, $day, $year) = split('.', $mydate);
$dt = gmmktime(0,0,0,$month, $day, $year); //this is today's date in a unix timestamp.

$periods = gmmktime(0,0,0,12,1,$year); //give you dec first in a timestamp.
$periodf = gmmktime(0,0,0,12,31,$year); //give you dec 31 in a timestamp.
$periods1 = gmmktime(0,0,0,1,1,$year); //give you jan first in a timestamp.
$periodf1 = gmmktime(0,0,0,1,31,$year); //give you jan 31 in timestamp.

//you'd have more of these...how ever many periods that you wanted.

if (compair($dt, $periods, $periodf))
{
      //output some html to include your css here.
}
elseif (compair($dt, $periods1, $periodf1))
{
     //output some html to include your css here.
}

?>


ofcourse none of this code is tested and is just ment to get you going in the right direction, so i don't know if there are errors in it or what. good luck.
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote