php echo different content on different dates -
i using date format echo example: thursday 8th august 2013
$day = date("l js f y");
i echo different content on different dates
for example if wednesday 25th december 2013 can echo "merry christmas"
this have tried, time format (y-m-d = 2013-25-12) have tried adding wednesday 25th december 2013.
what date format should $day = if im using $day = date("l js f y");
<p><?php if( $day == '2013-25-12' ) echo 'action="merry christmas"'; ?></p>
use strtotime() , date() formatted date compare $day:
<?php if( $day === date("l js f y", strtotime('2013-25-12'))) { echo 'merry christmas!'; } ?>
check out php documentation on date function. includes formatting specifications: http://php.net/manual/en/function.date.php
Comments
Post a Comment