1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP Date (don't display after certain date)

Discussion in 'HTML, Graphics & Programming' started by theMAD2, 3 Feb 2006.

  1. theMAD2

    Hitman

    Joined: 2 Aug 2005

    Posts: 680

    Hi,

    I'm trying to get my head around this but I don't know the format. Basically I want a div to change after a certain date (1st July 2007). Would it be something like this?

    Code:
    <?php 
    
    if (date("Y") < '2007' && date('M') < '07' && date("D") < '1') {
    print "text still counting down";}
    
    else { print "text past deadline" ;}
    
    ?>
    
    Thanks
     
  2. Dj_Jestar

    Caporegime

    Joined: 18 Oct 2002

    Posts: 29,066

    Location: Back in East London

    Code:
    if (time() < mktime(0, 0 , 0, 7, 1, 2007)) {
        echo '<div>blah</div>';
    }
     
  3. theMAD2

    Hitman

    Joined: 2 Aug 2005

    Posts: 680

    So that would be the div to display BEFORE the date is reached?
     
  4. Dj_Jestar

    Caporegime

    Joined: 18 Oct 2002

    Posts: 29,066

    Location: Back in East London

    Yip.
     
  5. theMAD2

    Hitman

    Joined: 2 Aug 2005

    Posts: 680

    Thanks mate :)