|
Hello all,
One of our PHP program bugged recently. I've reduced the problem to this:
April 4th!
Anybody can tell me if I'm doing something wrong? Why April 4th is not
printing but replaced by April 3rd? I'm using PHP 4.3.5
Yannick
--------- PHP file ---------
<html>
<head>
<title>Test</title>
</head>
<body>
<?
// First group
// This should print the three dates formated as requested: Y-m-d
print date("Y-m-d", mktime(0,0,0, 4, 3, 2004))."<br>"; // April 3rd 2004
print date("Y-m-d", mktime(0,0,0, 4, 4, 2004))."<br>"; // April 3rd 2004
print date("Y-m-d", mktime(0,0,0, 4, 5, 2004))."<br>"; // April 3rd 2004
// This should and do print the mktime corresponding to the numbers in the
third group of three
print mktime(0,0,0, 4, 3, 2004)."<br>"; // April 3rd 2004
print mktime(0,0,0, 4, 4, 2004)."<br>"; // April 4th 2004
print mktime(0,0,0, 4, 5, 2004)."<br><br>"; // April 5th 2004
// This too should print the three dates formated as requested: Y-m-d
print date("Y-m-d", 1080968400)."<br>"; // April 3rd 2004
print date("Y-m-d", 1081051200)."<br>"; // April 4th 2004
print date("Y-m-d", 1081137600)."<br><br>"; // April 5th 2004
?>
</body>
</html>
--------- PHP file end ---------
--------- Output - IE5.5 ---------
2004-04-03
2004-04-03
2004-04-05
1080968400
1081051200
1081137600
2004-04-03
2004-04-03
2004-04-05
--------- Output end --------- | |
Share:
|
Hi Yannick,
On Wed, 14 Apr 2004 17:33:13 -0400, "Yannick Turgeon"
<no****@nowhere.com> wrote: Hello all,
One of our PHP program bugged recently. I've reduced the problem to this: April 4th!
Anybody can tell me if I'm doing something wrong? Why April 4th is not printing but replaced by April 3rd? I'm using PHP 4.3.5
Have you checked your locale and daylight saving?
HTH, Jochen
Yannick
--------- PHP file --------- <html> <head> <title>Test</title> </head> <body> <? // First group // This should print the three dates formated as requested: Y-m-d print date("Y-m-d", mktime(0,0,0, 4, 3, 2004))."<br>"; // April 3rd 2004 print date("Y-m-d", mktime(0,0,0, 4, 4, 2004))."<br>"; // April 3rd 2004 print date("Y-m-d", mktime(0,0,0, 4, 5, 2004))."<br>"; // April 3rd 2004
// This should and do print the mktime corresponding to the numbers in the third group of three print mktime(0,0,0, 4, 3, 2004)."<br>"; // April 3rd 2004 print mktime(0,0,0, 4, 4, 2004)."<br>"; // April 4th 2004 print mktime(0,0,0, 4, 5, 2004)."<br><br>"; // April 5th 2004
// This too should print the three dates formated as requested: Y-m-d print date("Y-m-d", 1080968400)."<br>"; // April 3rd 2004 print date("Y-m-d", 1081051200)."<br>"; // April 4th 2004 print date("Y-m-d", 1081137600)."<br><br>"; // April 5th 2004 ?> </body> </html> --------- PHP file end ---------
--------- Output - IE5.5 --------- 2004-04-03 2004-04-03 2004-04-05
1080968400 1081051200 1081137600
2004-04-03 2004-04-03 2004-04-05 --------- Output end ---------
--
Jochen Daum - Cabletalk Group Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces. http://sourceforge.net/projects/phpdbedittk/ | | |
On Wed, 14 Apr 2004 17:33:13 -0400, "Yannick Turgeon" <no****@nowhere.com>
wrote: One of our PHP program bugged recently. I've reduced the problem to this: April 4th!
Anybody can tell me if I'm doing something wrong? Why April 4th is not printing but replaced by April 3rd? I'm using PHP 4.3.5
Yannick
--------- PHP file --------- <html> <head> <title>Test</title> </head> <body> <? // First group // This should print the three dates formated as requested: Y-m-d print date("Y-m-d", mktime(0,0,0, 4, 3, 2004))."<br>"; // April 3rd 2004 print date("Y-m-d", mktime(0,0,0, 4, 4, 2004))."<br>"; // April 3rd 2004 print date("Y-m-d", mktime(0,0,0, 4, 5, 2004))."<br>"; // April 3rd 2004
// This should and do print the mktime corresponding to the numbers in the third group of three print mktime(0,0,0, 4, 3, 2004)."<br>"; // April 3rd 2004 print mktime(0,0,0, 4, 4, 2004)."<br>"; // April 4th 2004 print mktime(0,0,0, 4, 5, 2004)."<br><br>"; // April 5th 2004
// This too should print the three dates formated as requested: Y-m-d print date("Y-m-d", 1080968400)."<br>"; // April 3rd 2004 print date("Y-m-d", 1081051200)."<br>"; // April 4th 2004 print date("Y-m-d", 1081137600)."<br><br>"; // April 5th 2004 ?> </body> </html> --------- PHP file end ---------
--------- Output - IE5.5 --------- 2004-04-03 2004-04-03 2004-04-05
1080968400 1081051200 1081137600
2004-04-03 2004-04-03 2004-04-05 --------- Output end ---------
Output on 4.3.5 here is:
2004-04-03
2004-04-04
2004-04-05
1080946800
1081033200
1081119600
2004-04-03
2004-04-04
2004-04-05
Changing the date format to include 'r' shows for your Unix dates:
2004-04-03 Sat, 3 Apr 2004 06:00:00 +0100
2004-04-04 Sun, 4 Apr 2004 05:00:00 +0100
2004-04-05 Mon, 5 Apr 2004 05:00:00 +0100
Is this a time zone issue? Doesn't Daylight Savings Time kick in on the first
Sunday in April in the US? So that would be the 4th.
--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space | | |
Hi guys,
you're rigth. It's related to dayligth saving. I just added 59 minutes to
the mktime function: same problem. And with 60, no problem.
Thanks for your help.
Yannick
"Andy Hassall" <an**@andyh.co.uk> wrote in message
news:74********************************@4ax.com... On Wed, 14 Apr 2004 17:33:13 -0400, "Yannick Turgeon" <no****@nowhere.com> wrote:
One of our PHP program bugged recently. I've reduced the problem to this: April 4th!
Anybody can tell me if I'm doing something wrong? Why April 4th is not printing but replaced by April 3rd? I'm using PHP 4.3.5
Yannick
--------- PHP file --------- <html> <head> <title>Test</title> </head> <body> <? // First group // This should print the three dates formated as requested: Y-m-d print date("Y-m-d", mktime(0,0,0, 4, 3, 2004))."<br>"; // April 3rd
2004 print date("Y-m-d", mktime(0,0,0, 4, 4, 2004))."<br>"; // April 3rd
2004 print date("Y-m-d", mktime(0,0,0, 4, 5, 2004))."<br>"; // April 3rd
2004 // This should and do print the mktime corresponding to the numbers in
thethird group of three print mktime(0,0,0, 4, 3, 2004)."<br>"; // April 3rd 2004 print mktime(0,0,0, 4, 4, 2004)."<br>"; // April 4th 2004 print mktime(0,0,0, 4, 5, 2004)."<br><br>"; // April 5th 2004
// This too should print the three dates formated as requested: Y-m-d print date("Y-m-d", 1080968400)."<br>"; // April 3rd 2004 print date("Y-m-d", 1081051200)."<br>"; // April 4th 2004 print date("Y-m-d", 1081137600)."<br><br>"; // April 5th 2004 ?> </body> </html> --------- PHP file end ---------
--------- Output - IE5.5 --------- 2004-04-03 2004-04-03 2004-04-05
1080968400 1081051200 1081137600
2004-04-03 2004-04-03 2004-04-05 --------- Output end --------- Output on 4.3.5 here is:
2004-04-03 2004-04-04 2004-04-05 1080946800 1081033200 1081119600
2004-04-03 2004-04-04 2004-04-05
Changing the date format to include 'r' shows for your Unix dates:
2004-04-03 Sat, 3 Apr 2004 06:00:00 +0100 2004-04-04 Sun, 4 Apr 2004 05:00:00 +0100 2004-04-05 Mon, 5 Apr 2004 05:00:00 +0100
Is this a time zone issue? Doesn't Daylight Savings Time kick in on the
first Sunday in April in the US? So that would be the 4th.
-- Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space | | This discussion thread is closed Replies have been disabled for this discussion. Similar topics
11 posts
views
Thread by Jim |
last post: by
|
2 posts
views
Thread by Tjerk |
last post: by
|
8 posts
views
Thread by Dennis M. Marks |
last post: by
|
38 posts
views
Thread by |
last post: by
|
9 posts
views
Thread by mistral |
last post: by
| |
4 posts
views
Thread by shapper |
last post: by
|
34 posts
views
Thread by -Lost |
last post: by
| | | | | | | | | | | |