Site copyright automatic date

Discussion in 'Programming' started by fadetoblack22, Sep 30, 2009.

  1. #1
    I have on the footer of my site - Copyright "site name" 2008. I forgot to change it when we entered 2009. I there a small piece of code I can insert to make the year change automatically?

    thanks.
     
    fadetoblack22, Sep 30, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    In php, you can do:

    Copyright site name <?php echo date('Y'); ?>
    PHP:
     
    premiumscripts, Sep 30, 2009 IP
    fadetoblack22 likes this.
  3. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #3
    or use this


     <script type="text/javascript">
    now = new Date
    theYear=now.getYear()
    if (theYear < 1900)
    theYear=theYear+1900
    document.write(theYear)
    </script>
    Code (markup):
     
    Bohra, Sep 30, 2009 IP
    fadetoblack22 likes this.
  4. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #4
    Thanks guys, I used the first one as it had less code :)
     
    fadetoblack22, Oct 1, 2009 IP
  5. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #5
    Yea first 1 is better as long as page is php if its html then javascript will do the trick
     
    Bohra, Oct 1, 2009 IP
  6. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #6
    Yeh, I forgot to say that I always use php pages.
     
    fadetoblack22, Oct 1, 2009 IP