dc2000 Posted July 26, 2007 Share Posted July 26, 2007 Hi everyone: I'm new to this forum, so please bear with me. I'm trying to write a small script to determine US holidays and change the site logo accordingly (pretty much like Google does). The problem happens with some US holidays, like Thanksgiving, that occurs on the 4th Thursday in November. How can I compute that? Here's my code snippet so far: $tm = time(); $month = int(date("n", $tm)); $day = int(date("j", $tm)); $weekday = int(date("w", $tm)); if($month == 11) { //Month of November //Now I have to see if it is 4th Thursday of the month??? } Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 26, 2007 Share Posted July 26, 2007 lookup mktime date function will deffently help ok. there you go m8 http://uk.php.net/mktime Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 26, 2007 Share Posted July 26, 2007 little example for you ok. <?php $today=date("d-m-Y"); $vip_day=date("d-m-Y", mktime(0, 0, 0, 07, 26, 2007)); if($today==$vip_day){ echo "It that specil day agin!"; }else{ echo" this is a bad day"; } ?> Quote Link to comment Share on other sites More sharing options...
dc2000 Posted July 26, 2007 Author Share Posted July 26, 2007 Thank you, redarrow, but what you did - you hardcoded the day for this year. As you can imagine the 4th Thursday in November falls on different days. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.