IF statement regarding dates

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • i love PHP

    IF statement regarding dates

    Hello guys ..

    my qustion is


    i have table in the database that have these two information


    The_date (in type Date)
    The_time (type_time)


    here is simple data in this table


    the_date = 2005-08-20
    The_time = 15:00:00


    what i need is simple if statement that compair the Server Time and
    date with this time and date .. and if the server time and date pass
    this time it will set value (X) to (false)


    example


    today is 7-06-2006 and lets say time is 15:00:00


    in the database the date is
    7-06-2006 and time are (14:59:00)


    in this case it will give me True


    other example


    today is 7-06-2006 and lets say time is 15:00:00


    in the database the date is
    6-06-2006 and time are (14:00:00)
    it will give me false becouse it pass this time


    i hope i was clear


    thanks

  • Colin McKinnon

    #2
    Re: IF statement regarding dates

    i love PHP wrote:
    [color=blue]
    > i have table in the database that have these two information
    > The_date (in type Date)
    > The_time (type_time)
    >
    > what i need is simple if statement that compair the Server Time and
    > date with this time and date .. and if the server time and date pass
    > this time it will set value (X) to (false)
    >[/color]

    Thanks for all the whitespace ilP, I was running out. You might love PHP but
    this is OT - you should be doing it in ${the database language of your
    choice}

    C.

    Comment

    • Alan Little

      #3
      Re: IF statement regarding dates

      Carved in mystic runes upon the very living rock, the last words of i
      love PHP of comp.lang.php make plain:
      [color=blue]
      > i have table in the database that have these two information
      >
      > The_date (in type Date)
      > The_time (type_time)
      >
      > what i need is simple if statement that compair the Server Time and
      > date with this time and date .. and if the server time and date pass
      > this time it will set value (X) to (false)[/color]

      $dbTime = strtotime("$The _date $The_time");

      if ($dbTime < time()) {
      }
      else {
      }

      --
      Alan Little
      Phorm PHP Form Processor

      Comment

      • Alan Little

        #4
        Re: IF statement regarding dates

        Carved in mystic runes upon the very living rock, the last words of
        Colin McKinnon of comp.lang.php make plain:
        [color=blue]
        > i love PHP wrote:
        >[color=green]
        >> i have table in the database that have these two information
        >> The_date (in type Date)
        >> The_time (type_time)
        >>
        >> what i need is simple if statement that compair the Server Time and
        >> date with this time and date .. and if the server time and date pass
        >> this time it will set value (X) to (false)
        >>[/color]
        >
        > Thanks for all the whitespace ilP, I was running out. You might love
        > PHP but this is OT - you should be doing it in ${the database language
        > of your choice}[/color]

        Heh? Why can't he do it in PHP? If you don't know the answer, are you
        just posting to admire your own cleverness?

        --
        Alan Little
        Phorm PHP Form Processor

        Comment

        Working...