473,221 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,221 software developers and data experts.

Date interogation: April 4th

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 ---------


Jul 17 '05 #1
3 1627
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/
Jul 17 '05 #2
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
Jul 17 '05 #3
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

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Jim | last post by:
I have been using the javascript below on a web page since last August to show the "Site updated" month only minus a month, which has been very successful, but January is showing a "undefined 2004"...
2
by: Tjerk | last post by:
Hello all, I have the script below to change an image depending on the date upto january it worked fine but then it just stopped working does anybody have an idea how I can make it work again or...
8
by: Dennis M. Marks | last post by:
What is the maximum valid date range for the date(yyyy,mm,dd) function. -- Dennis M. Marks http://www.dcs-chico.com/~denmarks/ Replace domain.invalid with dcsi.net -----= Posted via...
38
by: | last post by:
I have a script... ----- <SCRIPT language="JavaScript" type="text/javascript"> <!-- function makeArray() { for (i = 0; i<makeArray.arguments.length; i++) this = makeArray.arguments; } ...
9
by: mistral | last post by:
Need help to remove list of days from date script. Need format "June 07, 2006" <SCRIPT LANGUAGE="JavaScript"> <!-- Begin // Get today's current date. var now = new Date();
3
by: jamesDA | last post by:
I have written a simple membership database which prints cards using a report with an expiry date on. The expiry date should be the Date Issued field plus one year and one week. I can add 53 weeks...
4
by: shapper | last post by:
Hello, I have created a GridView on runtime by implementing the ITemplate class. This Gridview displays a list of articles. Each article has a Title, Content and PubDate. I am trying to...
34
by: -Lost | last post by:
I'm REALLY liking this so far. And for those who welcome something a little less cryptic than what the resident date guru offers, here's a chance to try something fairly elegant and definitely...
4
Sandboxer
by: Sandboxer | last post by:
I want to be able to program Access to provide for me, by individual day, what my contract obligations are to my customers. Will Access recognize all the individual days in between a date range...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.