Jump to content

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]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.