var sidebar_align = 'right';
var content_container_margin = parseInt('350px');
var sidebar_width = parseInt('330px');
How to display the local time of a certain city on a website?
I hope I can make clear what I want to do
I want to display the actual local time of a city on my website.
My first thought was something like actual server time plus/minus the time difference.
For example, I know that the local time of the city is 2 hours ahead from the time of the server location. Server time = 16:00, local time of the city = 16:00 + 2 hours = 18:00
Is there a simple script that calls the actual server time, adds a specified time difference and then displays the result as 00:00 - 23:59 on my website?
Or do you have a better idea? Any advice is much appreciated
You can select the specific timezone and create the code, i think.
Thank you, radhika, for the link, but unfortunately it doesn't work like intended
This script takes the time of the local computer (client) as the time source. When I change my local time, the time displayed on the website (= current local time of the city) gets changed, too.
Does anybody know a simple script or piece of HTML code that uses the server (where the website is located) time as the source time?
Something that displays the actual server time but can be modified by plus/minus some hours?
To make it more clear, I want something like this:
But only "day of the week" and "hours:minutes"
like Sunday 22:40, for example.
1. Go here:
2. There is a link at the bottom of page 'Time Zone Converter'.
3. If you select your local time in that boxes and press submit > gives you some code > put it on your web site.
4. Ask WHT members (from dufferent countries) to view that page. It should show their time.
You can try
Thank you for all your help, radhika. But the code only outputs a static time
And I can't write scripts
I only need a script like this:
1. Call local server time
2. Add x hours (x=variable)
3. Display time as (for example) Sunday 22:40 or May 01, 22:40
If all you are trying to do is display the time at the current viewers lcoation then it's easier to do via javascrip client side (unless they have it disabled).
If you want to just display particular times for particular places then server side scripting shouldn't be difficult. A trip to script archive sites should turn up a fair number.
"Obsolesence is just a lack of imagination."
The list of TZ codes are at
echo date("l dS of F Y h:i:s A");
hope it works out =]
Thanks NyteOwl and Diaga for your suggestions.
I will check it out as soon as my websites are reachable again.
They are down at the moment