/    Sign up×
Community /Pin to ProfileBookmark

Help with automatically updating weekly deadlines on Web page

Halo,

I have been searching for this answer in these
forums and unable to find it so far so I thought
I would make a post. I’m hoping some kind soul
here could help get me on the right track or guide
me to an easy to understand resource?

What I would like to do is be able to use PHP to
automatically print off a weekly deadline on my
Web page which automatically updates itself;
regardless of what the current day is.

So for example, today’s date is currently
Wednesday, January 19th. Lets say my deadline
for this week was Friday, January 21st. So even
though today is Wednesday, January 19th, what
I would like to have happen is have my Web page
read: “This weeks deadline is Friday, January 21st.”

Then on every Saturday morning around 12 am I would
like the deadline to automatically update itself to
the date for next Friday… which would become the
new deadline.

Note: I’m not wanting to include the current date
on the page. Just want to include the deadline…
which would basically always be the coming Friday
of each week, every week, of every year.

So lets say it was now Saturday, January 22nd. I would
like my Web page to automatically be updated all by itself
and read: “This weeks deadline is Friday, January 28th.”

Then lets say today’s date was Sunday, January 30th.
Again, I would like my Web page to automatically be updated
and read: “This weeks deadline is Friday, February 4th.”

(And so on and so forth…)

My question: How would I go about doing this using PHP?
Any tips or resources you’d like to share?

Thanks,

Mark
PS: I’m new to PHP and still learning so “laymen’s terms”
would be greatly appreciated. =)

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJan 20.2005 — [code=php]
<?php
# if today is friday, use today, else get next friday's timestamp
$nextFriday = (date("l")=="Friday") ? time() : strtotime("next Friday");
# output in "Weekday, Month daySuffix" format:
echo "<p>This week's deadline is " . date("l, F jS", $nextFriday) . "</p>n";
?>
[/code]

See online documentation on [url=http://us3.php.net/manual/en/function.strtotime.php]strtotime()[/url] and [url=http://us3.php.net/manual/en/function.date.php]date()[/url] for more info.
Copy linkTweet thisAlerts:
@webdeveloper01authorJan 20.2005 — WOW! Thank You NogDog!! =)

It's perfect!!

Mark
Copy linkTweet thisAlerts:
@NogDogJan 20.2005 — [i]Originally posted by webdeveloper01 [/i]

[B]WOW! Thank You NogDog!! =)



It's perfect!!



Mark [/B]
[/QUOTE]

There have been a bunch of date/time questions lately - by thinking about them I'm starting to get the hang of it in PHP now. ?
×

Success!

Help @webdeveloper01 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...