Thread: Logic Question
View Single Post
  #1   Spotlight this post!  
Unread 10-03-2006, 22:28
aubinhick990 aubinhick990 is offline
Programmer
FRC #0238 (Cruisin' Crusaders)
Team Role: Programmer
 
Join Date: Feb 2006
Rookie Year: 2005
Location: New Hampshire
Posts: 11
aubinhick990 is an unknown quantity at this point
Send a message via AIM to aubinhick990
Logic Question

This is a PHP website....

Okay, I have these variables...
PHP Code:
$itemE_year
    $itemE_month
    $itemE_day
    $itemE_hour
    $itemE_minute
    $itemE_ampm

    $year 
date("Y");
    
$month date("m");
    
$day date("d");
    
    
$hour date("h");
    
$minute date("i");
    
$ampm date("A"); 
Basically they're self-explanatory....the $itemE_x is just a number being assigned via the contents of a text file.

Now, my question is what logic would I need if I wanted to check if the Item's year/month/day and hour/minute has passed my server's year/month/day, hour/minute.

This is the logic I've come up with but it doesn't work quite right...

PHP Code:
if(  (($year >= $itemE_year)) )
{

    if(
$month == $itemE_month)
    {
      if(
$day >= $itemE_day)
         {
        
$DISPBOX "false";
        echo 
"Time has passed!";
         }
    } 

    if( ((
$hour >= $itemE_hour) and ($minute >= $itemE_minute)) and ($ampm == $itemE_ampm) )
{
Whatever else I'm doing....

Any suggestions? Thanks a ton!

Last edited by aubinhick990 : 10-03-2006 at 22:30.