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.

Displaying this year to next year

Discussion in 'PHP' started by jpinheiro, Aug 9, 2008.

  1. #1
    Hey, cant figure out how to get this code to work?

    
    
    <?php
    
    $nextyear  = mktime(0, 0, 0, date("m"),   date("d"),   date("Y")+1);
    
    ?>
    
    Copyright &copy; <?php print date("Y"); ?> - <?php print "$nextyear"; ?>
    
    
    PHP:
    But Displays:

    Copyright © 2008 - 1249790400

    Why is it showing that instead of 2009
     
    jpinheiro, Aug 9, 2008 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    mktime() returns a UNIX timestamp: www.php.net/mktime and not a date in a human readable format.

    You already have what you need, you're just over complicating it. ;)
    
    Copyright &copy; <?php print date("Y"); ?> - <?php echo date('Y') + 1; ?>
    
    PHP:
     
    nico_swd, Aug 9, 2008 IP
  3. jpinheiro

    jpinheiro Peon

    Messages:
    1,211
    Likes Received:
    15
    Best Answers:
    1
    Trophy Points:
    0
    #3
    lol i had that b4 except i messed up on 1 piece i didnt know what i put this originaly

    
    
    Copyright &copy; <?php print date("Y"); ?> - <?php print date('Y')+1); ?>
    
    
    PHP:
    And it Didnt work XD lol
     
    jpinheiro, Aug 9, 2008 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    Check your parenthesis. There are too many...
     
    nico_swd, Aug 9, 2008 IP