Hi,
I have a website where I'm using the following PHP
<?php echo date("H:i l jS F Y"); ?>
in my page.tpl.php file to output the time and date. The problem is my web site is hosted on a US server but I want the date and time to be for the UK.
Anyone know how I can solve this?
Thanks,
Laurence.

Comments

Home Remodeling Webmaster’s picture

Hello
If you are using Drupal, then You can solve it right now, but if you are using some open source php lanaguge, then I'll not help you :) ... but here is the solution:

Go to administrator >>>>> rolling down the mouse and then pointing out at time and date menu.. there you can find different time zones, hope this will help you ...

Thanks

Bilal

laurencemercer’s picture

Hi Bilal,
thanks for your reply.
Unfortunately I think your solution would only work for setting the time on the actual site. What I am doing is using PHP to call the time directly from the server so I think it is immaterial what time I set the site at (not sure about this).
Anyway, I have found a solution which suits my needs
<?php $differencetolocaltime=8; $new_U=date("U")+$differencetolocaltime*3600; print date("H:i l jS F Y", $new_U); ?>
- basically taking the US server time and adding the time difference to the UK.
A more detailed explanation can be found here.
Thanks,
Laurence.

www.lhmdesign.com - Drupal themes and Drupal theming services.
My Drupal blog - Drupal theming, one post at a time.