1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

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