/    Sign up×
Community /Pin to ProfileBookmark

A difficult task

Hello!

I am running a livescore, which is updating from outside. The problem is, that all the start hours of the matches are depending on the time zone of the country they are being played in. For example:
All England matches start at 15:00 PM UK time, All Spanish matches start at 17:00 spanish time.
What I want, is to get all times in the timezone of my country. That means, that I have to shift all hours in different way, depending on their nationality. For example, I have to put all the english matches start times plus 2 hours, and all the spanish plus one hour.
The problem is, that as I mentioned above, the livescore is updating from outside, and I have no idea of the structure of its code. All I have is echo $html; and that $html contains everything – the countries, the matches, the results, the times etc. So, the only thing I am able to do is to make some replacements, and here goes the whole problem, because I don’t know how to describe them.

The html code of the area with the times looks like this:

<tr bgcolor=”#82FC74″><td class=”title” colspan=”4″ height=”18″>&nbsp;<b>England</b> – Premiership</td></tr>
<tr bgcolor=”#82FC74″><td class=”match-light” width=”45″ height=”18″>&nbsp;10:35</td><td class=”match-light” align=”right” width=”286″ colspan=”3″>September 13&nbsp;</td></tr>
<tr><td colspan=”4″ height=”1″></td></tr><tr bgcolor=”#cfcfcf”><td width=”45″ height=”18″>&nbsp;21:15</td><td align=”right” width=”118″>Chelsea</td><td align=”center” width=”50″>? – ?</td><td width=”118″>Liverpool</td></tr><tr><td colspan=”4″ height=”1″></td></tr><tr bgcolor=”#FFFFFF”><td colspan=”4″ height=”4″></td></tr><tr><td colspan=”4″ height=”1″></td></tr>

The onliest idea I am up to is to describe a function approximately with the following content:

function settimes() {
if (text in the <td tag with class=”title”> contains the word “England”) {
shift the hours in the next <td tag with class=”match-light”> plus 2 hours;
shift the hours in all following <td tags without defined class> plus 2 hours until the next <td tag with class=”title”>;
}
if (text in the <td tag with class=”title”> contains the word “Spain”) {
shift the hours in the next <td tag with class=”match-light”> plus 1 hour;
shift the hours in all following <td tags without defined class> plus 1 hour until the next <td tag with class=”title”>;
}
}

I know how to shift the hours, that’s an easy task, but what I don’t know is how to describe this function in PHP. Do you have any ideas how can I do it? I know it is possible, because there are other websites, using the same script as me, which have set their times.
If you need more information about the html code you can view my website at: [url]http://livescore-bg.net[/url]

I hope there is somebody to help me, because I even don’t know where to start from.?

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@DARTHTAMPONSep 20.2008 — Is the return coming back in UTC?

If they are you will have to record the usetime on your site and adjust accordingly.

If not you will have to still record the user info and adjust accordingly.
×

Success!

Help @pastet89 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.28,
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,
)...