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.

Birthday countdown script

Discussion in 'PHP' started by hrdmn, Mar 29, 2007.

  1. #1
    Can anyone help me?
    I'm a newbe.
    I need a php countdown birthday script (no database using if possible)

    for example script displaying: 331 days till my birthday
     
    hrdmn, Mar 29, 2007 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    
    <?
    function until( $date, $occasion = "birthday", $for = "my" )
    {
    	$unix = strtotime( $date );
    	if(!$unix) :
    		printf( "%s is not a valid date format", $date );
    	else:
    		printf("%d days till %s %s ( %s )", ( $unix - time() ) / 86400, $for, $occasion, date("dS F Y", $unix ) );
    	endif;	
    }
    until( "18th March 2008"  );
    
    PHP:
    due to limitations of strtotime, you can't do dates that far in the future, but for birthdays it'll work.....
     
    krakjoe, Mar 29, 2007 IP
  3. hrdmn

    hrdmn Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks dude :)
    it works just fine :)
     
    hrdmn, Mar 29, 2007 IP