M1TCH3LL Posted January 20, 2007 Share Posted January 20, 2007 Hey. Sorry my thread title is a little weird, but it was the best way I could describe it shorthand.Basically, I have a website where I want the content to change according to the day. So on Monday it'll say one thing, and Tuesday it'll say something different, etc.I found a code to use, which basically reads like this...[code]<?php $d=date("D");if ($d=="Sat")echo "Insert Content 1 Here"; elseif ($d=="Sun")echo "Insert Content 2 Here"; elseecho "Insert Content 3 Here";?>[/code]It works great, except that it updates in GMT time, and I need it to be in EST time, five hours behind.Any ideas what I need to do to resolve this?Thanks. Link to comment https://forums.phpfreaks.com/topic/34986-content-change-via-php-needed-in-est-time/ Share on other sites More sharing options...
redbullmarky Posted January 20, 2007 Share Posted January 20, 2007 you could always just subtract 5 hours when getting the day.[code]<?php$five_hours_ago = time() - (60*60*5);$d = date("D", time() - $five_hours_ago);?>[/code]i'm sure there's a function that allow time adjustments like this, but i cant recall what it is, tho sure someone will point it out... Link to comment https://forums.phpfreaks.com/topic/34986-content-change-via-php-needed-in-est-time/#findComment-164992 Share on other sites More sharing options...
M1TCH3LL Posted January 20, 2007 Author Share Posted January 20, 2007 So I've made the code as:[code]<?php$five_hours_ago = time() - (60*60*5);$d = date("D", time() - $five_hours_ago);if ($d=="Sat")echo "Insert Content 1 Here"; elseif ($d=="Sun")echo "Insert Content 2 Here"; elseecho "Insert Content 3 Here";?>[/code]But now it is only calling the "else" piece, even though it is now Saturday and should be calling on the Saturday piece. :( Link to comment https://forums.phpfreaks.com/topic/34986-content-change-via-php-needed-in-est-time/#findComment-165011 Share on other sites More sharing options...
redbullmarky Posted January 20, 2007 Share Posted January 20, 2007 whoops my bad. here:[code]<?php$five_hours_ago = time() - (60*60*5);$d = date("D", $five_hours_ago);if ($d=="Sat")echo "Insert Content 1 Here"; elseif ($d=="Sun")echo "Insert Content 2 Here"; elseecho "Insert Content 3 Here";?>[/code] Link to comment https://forums.phpfreaks.com/topic/34986-content-change-via-php-needed-in-est-time/#findComment-165015 Share on other sites More sharing options...
M1TCH3LL Posted January 20, 2007 Author Share Posted January 20, 2007 Worked perfectly. Thank you ;D Link to comment https://forums.phpfreaks.com/topic/34986-content-change-via-php-needed-in-est-time/#findComment-165038 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.