/    Sign up×
Community /Pin to ProfileBookmark

PHP Script: Text output between specific hours.

[code=php]

<?php
/*
Script by Paul Carpenter ( [email][email protected][/email] )

For details on the date(); function see
[url]http://php.net/date[/url]

Modified by Joachim Heimfeld
*/

$hour = date(‘H’);
$day = date(‘D’);

switch (TRUE){
case ($hour > 21 && $day == ‘Sat’):
$show = ‘The Weekend Show’;
break;

case ($hour < 7 && ($day == ‘Sat’ || $day == ‘Sun’)):
$show = ‘Hit Selector ‘;
break;

default:
$show = ‘Hit Selector’;
break;
}

echo “<align=’left’><font face=’verdana’><font size=’2′><b>Current Show On Air: </b><font color=’yellow’>$show</font>”;

?>
[/code]

A month ago someone created this PHP script for me, I changed it a little bit but would like some help. I can’t reach the author. If I would like to make the time be according to GMT +1 how would I do this? Does the script show according the system time or some set time? I would like it set time because everyone should see the same thing at the same hours.

Also I would like to add the following shows:

Wednesday 22:00 – 23:00 (1 hour): Top 10 at 10

Please help.

Thank you.

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@JuuitchanAug 17.2006 — The function gmdate() is just like date(), except that it always gives you Greenwich Mean Time.

The way I see it is, to solve your problem I would do this:

- Get the current time using time().

- Add 3600. (This is the number of seconds in an hour.)

- Use gmdate() on this number.

How do you intend to deal with Daylight Saving Time (or Summer Time, as you might call it)?
Copy linkTweet thisAlerts:
@Joachim_JoeauthorAug 18.2006 — HI Juuitchan, GMT would not be the best idea because sometimes we have 1hr difference, or even 2 hr difference to Germany. The Time should be according to German time, so GMT +1 unless the script can be configured with DST to work correctly.
×

Success!

Help @Joachim_Joe 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 5.25,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...