Jump to content

Content Change Via PHP, Needed In EST Time...


M1TCH3LL

Recommended Posts

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";
else
echo "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.
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...
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";

else
echo "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. :(
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";

else
echo "Insert Content 3 Here";
?>
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.