Looking for PHP solution: set date switches to "now"

Discussion in 'PHP' started by swortis, May 18, 2007.

  1. #1
    I'm sure this is an easy one. I'm looking for a small PHP script where I can have a set date (eg "November 13") appear, until that date arrives at which point "Now" would appear instead.

    Thanks!
     
    swortis, May 18, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    $date = '13 November 2007';
    
    if (time() < strtotime($date))
    {
        echo $date;
    }
    else
    {
        echo 'Now';
    }
    
    
    PHP:
     
    nico_swd, May 18, 2007 IP
  3. coderbari

    coderbari Well-Known Member

    Messages:
    3,168
    Likes Received:
    193
    Best Answers:
    0
    Trophy Points:
    135
    #3
    great work pal.i was looking for a solution for this type of date matching problem.this code shows me the way.thanks nico_swd and also thanks to the thread opener.
     
    coderbari, May 19, 2007 IP