 |
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

October 4th, 2004, 10:46 AM
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
time is 1hr back?!
HI all,
 I have found out how to manipulate the gmdate() function but when I come to extract the time out, the time is one hour back.
I have tried adding an extra hour to the time, but to no success.
e.g. My current UK time is now 16:45.
When I come to display the time, the screen says 15:45
any ideas anyone?!...
Michael.
__________________
Michael.
|

October 4th, 2004, 04:54 PM
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Are you using a remote server? Is it in the same time zone?
-Snib <><
http://www.snibworks.com
There are only two stupid questions: the one you don't ask, and the one you ask more than once ;)
|

October 5th, 2004, 03:41 AM
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi there,
I am using the server locally here at work. I have checked both times on the server and on my computer and both are the same to GMT time, (UK).
this is why im a bit confused why gmDate() is not picking up the correct time.
I have looked at the php.ini and httpd file and can not find any mention of date or time within the file.
Michael.
|

October 5th, 2004, 03:02 PM
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Try this:
$time = gmdate('format',time()+1200);
HTH,
-Snib <><
http://www.snibworks.com
There are only two stupid questions: the one you don't ask, and the one you ask more than once ;)
|

October 6th, 2004, 05:09 AM
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
That worked but, another problem has appeared with the minutes.
The server time is now 11:07. when i come to use the code:
Code:
<?php
$timeNow = gmdate('H:i:s',time()+1200);
echo $timeNow;
?>
the time generated in PHP is: 10:27:08.
There now seems to be an addition of 20 minutes??! this is bizzare.
any ideas why this is happening or a way around this?
thanks.
Michael.
|

October 6th, 2004, 05:16 AM
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
to add onto the above email with the minute problem.
The Server is Windows 2000, running Apache 2.0.47, PHP 4.3.3 and MySQL 4.0.15.
cheers.
Michael.
|

October 6th, 2004, 04:15 PM
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
The time you told me PHP is giving is 10:27:08 when it should be 11:27:08.
So try this:
<?php
$timeNow = gmdate('H:i:s',time()+1500);
echo $timeNow;
?>
And this:
<?php
$timeNow = gmdate('H:i:s',time()+2700);
echo $timeNow;
?>
-Snib <><
http://www.snibworks.com
There are only two stupid questions: the one you don't ask, and the one you ask more than once ;)
|

October 7th, 2004, 05:47 AM
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hiya,
yes, originally it was saying 10:27:08 when it should be 11:27:08 but when the time was edited to include +1200, it altered the time again.
ive played around with the time additions and the time is now fixed.
Solution made is: $timeNow = (gmdate('H:i',time()+3600));
Im still finding it strange how its not picking up the local server time.
Thanks for your help Snib. =)
Michael.
|
|
 |