IF Statement Date comparison

Discussion in 'PHP' started by LazyD, Feb 12, 2007.

  1. #1
    Hello All, im looking for a simple date comparison if statement. I searched google and only found one result worthwhile and for whatever reason I couldnt seem to get it to work, they were using strtotime()..

    Anyway, just looking for a simple setup like:

    if ($ThisDate is in the past) {
    echo "sorry, this date has arleady passed";
    } else {
    echo "Sign Up Now!";
    }
     
    LazyD, Feb 12, 2007 IP
  2. designcode

    designcode Well-Known Member

    Messages:
    738
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    118
    #2
    designcode, Feb 12, 2007 IP
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #3
    EDIT: A few seconds too late...

    strtotime() is probably the easiest way to do it. In which format is your date?
     
    nico_swd, Feb 12, 2007 IP
  4. LazyD

    LazyD Peon

    Messages:
    425
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I got it, thanks guys, it took a little modification to the code provided by that webpage but it works awesome now, thanks.
     
    LazyD, Feb 12, 2007 IP