It's random, too damn random.


Year PHP Code Code

December
2
2008
Posted by Shaibani | Tags: , , ,

EDIT: date Instead of the_time

If you wanna use the current year for a copyright statement or whatever and not have to update it every year (if you’re that lazy :P ) Here’s how:

If you’re in a WordPress environment:

1
<?php the_time('Y'); ?>

Output: 2008
(Yes, I can execute PHP in my posts.)

And in any normal .php page, you can get the year from your server.

1
<?php echo date('Y'); ?>

Output: 2010
So on exactly 31/12/2008 11:59, it’ll be 2010, and the next minute, well.. you know what’s gonna happen. :-)

No related posts.

One Response to “Year PHP Code”

  1. Thanks, this was helpful!

    Comment by Kathy on March 25, 2010 at 6:31 pm



Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes