UK WEB HOSTING FORUM FOR DISCUSSION ON WEB HOSTING SERVICE AND SUPPORT
LINUX HOSTING WINDOWS HOSTING PACKAGES SHOPPING CART OSCOMMERCE ZEN CART AGORA
ECOMMERCE HOSTING ASP MSSQL FRONTPAGE HOSTING PHP MYSQL HOSTING DISCUSSION FORUM
CPANEL RESELLER HOSTING DEDICATED SERVER VPS HOSTING PLESK VIRTUOZZO
Quick Search
Your forum announcement here!

  UK Web Hosting | Dedicated Server Windows and Linux VPS Forum > Web Hosting and Domains > PHP Hosting

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 16-05-2007, 10:10
new member
 
Join Date: May 2007
Posts: 3
Default displaying local time using PHP

Hi All,

I'm sure there is a quick answer to this one:

I have a copper plan linux hosting account. I'm interested in displaying the date-time on my html pages using PHP.

No problem there, but I'm getting the gmt time when I need the local time. At the moment, the displayed time is one hour ahead (at 11:07 bst it is showing 10:07)

any ideas on how to do this?
I did some reading on the PHP help pages and am using the following code (which doesn't work unfortunately)

PHP Code:
<?php
     setlocale
(LC_TIME'en_UK');
    
$today strftime("%B %d %G %R");
    echo 
"$today<br><br>";


?>
Any ideas on this one?

Thanks in advance,

ShaunH
Reply With Quote
  #2 (permalink)  
Old 16-05-2007, 10:32
Premium Member
 
Join Date: Mar 2007
Posts: 423
Default

this page might be what you're looking for LINK - it involves specifying the time in relation to GMT by x number of hours. You could also just call the user's local system time too I think.
Reply With Quote
  #3 (permalink)  
Old 16-05-2007, 13:18
DPS Computing's Avatar
Premium Member
 
Join Date: Apr 2007
Location: Manchester, United Kingdom
Posts: 4,493
Send a message via ICQ to DPS Computing Send a message via AIM to DPS Computing Send a message via MSN to DPS Computing Send a message via Yahoo to DPS Computing Send a message via Skype™ to DPS Computing
Default

True you can call the users local time but you can also just add 1 to the hour variable .
__________________
David Smith
DPS Computing
http://www.dpscomputing.com (Computing, Reviews, News) - New site / new polls / new stories! With many more to follow!
NEW LAUNCH! http://djdavid.dpscomputing.com (My DJ Website)
NEW LAUNCH! http://davidsmith.dpscomputing.com (My Personal Website)
Reply With Quote
  #4 (permalink)  
Old 16-05-2007, 15:08
new member
 
Join Date: May 2007
Posts: 3
Default

Quote:
Originally Posted by DPS Computing View Post
True you can call the users local time but you can also just add 1 to the hour variable .
Thanks both for your quick replies.

I did think that I could apply the 1 hour displacement, but can't this be done automatically?

I'm bound to forget this when it needs to be done at some point. I sort of assumed that this capability would be built into the Server/PHP...


Regards,

ShaunH
Reply With Quote
  #5 (permalink)  
Old 16-05-2007, 18:28
DPS Computing's Avatar
Premium Member
 
Join Date: Apr 2007
Location: Manchester, United Kingdom
Posts: 4,493
Send a message via ICQ to DPS Computing Send a message via AIM to DPS Computing Send a message via MSN to DPS Computing Send a message via Yahoo to DPS Computing Send a message via Skype™ to DPS Computing
Default

I'm sure it is, I just don't know what it is off hand.

However I have remembered that some programming languages have (at least in past versions I have used) not allowed for DST.

If you want it automatically I suppose you could set the series of dates that is DST and add the hour and then set a series of date it is normal GMT. This would involve some kind of If statement but would be harder to implement.

I will keep a look out for some more information on it for you.

Hope that helps .
__________________
David Smith
DPS Computing
http://www.dpscomputing.com (Computing, Reviews, News) - New site / new polls / new stories! With many more to follow!
NEW LAUNCH! http://djdavid.dpscomputing.com (My DJ Website)
NEW LAUNCH! http://davidsmith.dpscomputing.com (My Personal Website)
Reply With Quote
  #6 (permalink)  
Old 16-05-2007, 19:46
new member
 
Join Date: May 2007
Posts: 3
Default

Quote:
Originally Posted by DPS Computing View Post
I'm sure it is, I just don't know what it is off hand.

If you want it automatically I suppose you could set the series of dates that is DST and add the hour and then set a series of date it is normal GMT. This would involve some kind of If statement but would be harder to implement.

I will keep a look out for some more information on it for you.

Hope that helps .
Thanks, for the moment I've used the following to do a quick fix , and will try to do some research (google ) myself to find out if I can automate the process at a later point
PHP Code:
    setlocale(LC_TIME'en_UK');
       
$currentDateTime=strtotime("+ 1 hour"); // add 1 hour for BST
       
$today strftime("%B %d %G %R",$currentDateTime);
    echo 
"$today<br><br>"
Thanks for your help,

Best wishes,

ShaunH
Reply With Quote
  #7 (permalink)  
Old 17-05-2007, 10:59
DPS Computing's Avatar
Premium Member
 
Join Date: Apr 2007
Location: Manchester, United Kingdom
Posts: 4,493
Send a message via ICQ to DPS Computing Send a message via AIM to DPS Computing Send a message via MSN to DPS Computing Send a message via Yahoo to DPS Computing Send a message via Skype™ to DPS Computing
Default

Quote:
Originally Posted by ShaunH View Post
Thanks, for the moment I've used the following to do a quick fix , and will try to do some research (google ) myself to find out if I can automate the process at a later point
PHP Code:
    setlocale(LC_TIME'en_UK');
       
$currentDateTime=strtotime("+ 1 hour"); // add 1 hour for BST
       
$today strftime("%B %d %G %R",$currentDateTime);
    echo 
"$today<br><br>"
Thanks for your help,

Best wishes,

ShaunH
No problem, any time .
__________________
David Smith
DPS Computing
http://www.dpscomputing.com (Computing, Reviews, News) - New site / new polls / new stories! With many more to follow!
NEW LAUNCH! http://djdavid.dpscomputing.com (My DJ Website)
NEW LAUNCH! http://davidsmith.dpscomputing.com (My Personal Website)
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:26.

 

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by Web Hosting 3.1.0
Copyright © 2001-2008, eUKhost.com. All rights reserved.

 
Site Map

VPS Hosting
VPS Hosting plans

Dedicated Server Hosting
Dedicated Server plans

Business Web Hosting
100% uptime Hosting

Cpanel Hosting
cPanel Shared Hosting

Reseller Hosting
Reseller Web Hosting

Windows Hosting
Windows Shared Hosting

Windows VPS

Windows VPS Hosting

Semi Dedicated Servers
Semi-Dedicated Hosting

Dedicated Server Mirroring
Dedicated Server Mirroring

Webhosting Knowledgebase
Frequently asked Questions

Web Hosting Blog
eUKhost Blog

Web Hosting Support
Support Helpdesk

UK Data Center
eUKhost Datacenter

Web Hosting Forum
eUKhost Forum

Support Tutorials
Online Flash Tutorials

Offsite Back-up Plans
Remote Backup Service

Customer Testimonials
eUK Customer Testimonials


knowledgebase articles

eUKhost.com Services

Pre-Sales Questions
Pre-sales FAQ's

Domain Names
Domain registration FAQ's

cPanel Hosting
cPanel Hosting FAQ's

Windows Web Hosting
Plesk Control Panel

Reseller Hosting
Reseller Hosting FAQ's

VPS Hosting
Virtual Private Server

Semi-Dedicated Servers
Semi-Dedicated FAQ's

Dedicated Servers
Dedicated Server Hosting


popular blog categories


Web Hosting
Website Hosting articles

UK Web Hosting
UK Hosting articles

Dedicated Server Hosting
Dedicated Server guidelines

VPS Hosting
VPS hosting articles

cPanel Hosting
cPanel Hosting articles

Linux Operating System
Linux Operating techniques

Windows Web Hosting
Windows plesk articles