PHP function to display current year

No GoodNeed ImprovementOKGoodExcellent (4 votes, average: 5 out of 5)
Loading ... Loading ...

If your web site has copyright footer and you want it to display current year, you can use PHP date function to make year current. For example, the follow lines of code will display owner’s copyright notice from 2002 to current year (2007):

<STYLE TYPE="text/css" MEDIA=screen>
<!–
.Footnote
{
font-family: Arial, Helvetica, Sans-Serif;
font-size: 11px;
color: #999999;
}
–>
</STYLE>
<p align=center><font class=”Footnote”>© 2002-<?php echo date(’Y'); ?> Web Designed by
<a href=”http://www.innovitainc.com“>
<img src=”/images/InnoVitalogo1.jpg” valign=”TOP” border=”0″ height=”14″ width=”18″><b>
<i><font color=”red”>Inno</font><font color=”green”>Vita</font></i><font color=”blue”>
Inc.</font></b>.</a> All rights reserved.</font></p>

Popularity: 6%

3 Comments »

  1. CJ said,

    April 29, 2007 @ 6:56 pm

    Hiya,

    Just wanted say cheers !!! I looked on the PHP site and as usual it went on about a load of codsh?t with like 15 lines of code, ALL I WANTED WAS “” !!!!

    Cheers again, thanks to the big G your site has made it into my bookmarks ;-)
    Regards

  2. Adam Kayce said,

    July 25, 2008 @ 1:10 pm

    By the way, if someone who doesn’t really know what they’re doing copies the code you have for the ‘year’ piece, they’re going to be in for a surprise…

    The first apostrophe is curly; the second one is straight (you’d want them both straight). Like this: (’Y')

    Thanks!

  3. Harish said,

    August 2, 2008 @ 12:52 pm

    Thanks. Would visit your website again to read if there is anything more that I can use.

RSS feed for comments on this post · TrackBack URI

Leave a Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word