Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date/time reported incorrectly?

Status
Not open for further replies.

Borvik

Programmer
Jan 2, 2002
1,392
US
This is a little confusing and I'm not sure why the date/time is being reported incorrectly.

The time is being reported one hour ahead of what it actually is.

Here is the php code I'm using to test.
Code:
<?php
print date('d M Y, H:i');
?>
The server is a linux box (FC4), and I've verified using the date command.

Here are the results:
Webpage:
Code:
25 Mar 2008, 11:32
Command-line:
Code:
# date
Tue Mar 25 10:32:27 EST 2008

Anybody have any clue as to what might be going on?

Oh btw, the timezone/dst value reported by the date command in php is being reported: America/New_York 1 - and yes that is the proper timezone.
 
is your system allowing for daylight savings? php will do so.
 
Well according to the command:
Code:
zdump -v /etc/localtime EST5EDT | grep 2008
It is apparently enabled - and since the system time is correct I would assume that the system is taking care of DST.
 
I realize PHP date function displays server time.

I've checked the server time from the command line and checked it against what PHP is reporting. They do not match. This is all on the server. (BTW, the server time matches my client time as well).
 
borvik, is the info you reported as a result of the date_default_timezone_get() function?
 
Borvik,
I have one machine (Mandrake 9.1 -- old). My cron jobs are doing the same thing. I started looking into it, but then had to move on to something else. I haven't been back yet. I know it has to do with DST. I don't care if my jobs are an hour off. The code I have using php on that box shows the right time. It's odd. I'll let you know if I find anything.

Mark
 
jpadie - I assume you are referring America/New_York 1 - in which case, no I didn't use the date_default_timezone_get function. It's just the date function with the format string: 'Y-m-d g:i A e I'.

Kozusnik - thanks.
 
ok. could you echo the results of date_default_timezone_get() and see whether it reports the same timezone as you expect?

 
Ok, the results of date_default_timezone_get() are the same: America/New_York.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top