comparing dates British style

Discussion in 'PHP' started by asgsoft, May 18, 2010.

  1. #1
    Hey everyone!

    This problem has been baffling me all day today.

    I am trying to compare dates which are in the British format to see if they are bigger and/or smaller than todays date.

    This is what I am using:

    
    if($start <= date("d/m/Y") && $end >= date("d/m/Y")){
    bla;
    }
    
    PHP:
    What this should do is compare and see if todays date falls between the $start and $end

    Where am I going wrong?
     
    asgsoft, May 18, 2010 IP
  2. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #2
    When using comparison operators (namely those shown in your example) - require a number (either integer or float) as one of the parameters. The divider (the slash) within your date() is the cause, theirfore remove it to make it a number.
     
    danx10, May 18, 2010 IP
  3. phpSiteMinder

    phpSiteMinder Peon

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Convert them to unix time stamps and it will work. theres a php function to do it, cant recall of the top of my head what its called though
     
    phpSiteMinder, May 18, 2010 IP