Re: [PHP] plugging gmmktime value into gmdate yields incorrect date

2007-02-16 Thread Terra Frost

Jim Lucas wrote:

Brad Fuller wrote:

-Original Message-
From: Brad Fuller [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 15, 2007 3:48 PM
To: 'Terra Frost'; 'Peter Lauri'
Cc: php-general@lists.php.net
Subject: RE: [PHP] plugging gmmktime value into gmdate yields incorrect
date


-Original Message-
From: Terra Frost [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 15, 2007 3:20 PM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: [PHP] plugging gmmktime value into gmdate yields 
incorrect

date

date('Z') on the server producing the incorrect output returns 
3600.  On

the other two, I get -18000 and -21600.

That said, I don't see how that'd make a difference.  The whole reason
I'm using the gm* functions, in the first place, is because those are
supposed to work with a fixed timezone - GMT.  Testament to this is 
the

fact that gmdate('Z') returns 0 on all three of those.

Peter Lauri wrote:
And what are the time zones for those two different machines? And 
what

is

the time? :)

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Terra Frost [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 15, 2007 8:47 PM
To: php-general@lists.php.net
Subject: [PHP] plugging gmmktime value into gmdate yields incorrect

date

I tried running the following script on three different servers:

?php
echo gmdate('m, d, Y', gmmktime(0,0,0,3,23,2000) );
?

On two of the servers, I got 03, 23, 2000 back.  On the other,
however, I got 03, 22, 2000.  This doesn't make any sense to me.

On the servers that return the correct date (03, 23, 2000),
gmmktime(0,0,0,3,23,2000) returns 953769600.  On the server that
returns the incorrect date (03, 22, 2000), gmmktime(0,0,0,3,23,2000)
returns 953766000.  There's a difference of 3600 between the two,
which makes me think that some daylight savings time setting is to
blame.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


I may be way off... but isn't it redundant to use both gmdate() and
gmmktime()?  I thought each of these functions were used to convert 
your

local time into GMT...

So for example if you're GMT+5, the gmmktime() would subtract 5 
hours, and

then gmdate() would subtract another 5 hours?

Like I said - I could be way off, but just a thought.

-Brad


Yes, I was a little off...

gmmktime() takes a GMT date and converts it to a local unix timestamp.
gmdate()   takes a local unix timestamp and converts it to a GMT date.

So in theory you *should* get the same date you put in, if using both
functions like your example.

I think you are on the right track with the Daylight Saving time issue.

Starting this year, DST in the U.S. begins in March instead of April.
Given that the year of your date input is 2000, it shouldn't be 
affected,
but perhaps that is in fact the culprit? Your date 3/23 falls in 
between the

previous and future DST start dates.

Hmm...

Have you gotten similar results using a different month/day?

-Brad



if you run:

echo gmdate('I', gmmktime(0,0,0,3,23,2000) ); //Capital 'i'

I (capital i) - 1 if Daylight Savings Time, 0 otherwise.

This might help you

I got 0 on all three servers (even the one that's giving the incorrect 
dates).


According to php.net, though, daylight savings time settings shouldn't 
make a difference:


is_dst:
Parameters always represent a GMT date so is_dst  doesn't influence
the result.

I tried to play around with that setting, all the same.

On the server that was reporting a date that was a day off (which is 
running PHP 4.1.2 on Sun Solaris), gmmktime(0,0,0,3,23,2000,1) gave the 
correct answer.  gmmktime(0,0,0,3,23,2000,0) gave the incorrect answer.


On one of the servers that gave the correct answer (running PHP 4.4.3 on 
some distro of Linux), gmmktime(0,0,0,3,23,2000,0) gave the correct 
answer and gmmktime(0,0,0,3,23,2000,1) gave the incorrect answer.


On the last server (running PHP 4.4.4 on Windows), the last parameter 
doesn't make a difference.  It returns the correct answer regardless.


Making them all run on the same version of PHP would be nice, but two of 
the three are on shared hosts which I have no real influence over.  
Besides, I'd prefer to have this yield the same results on all three of 
those servers - to be as cross-server compliant as possible.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] plugging gmmktime value into gmdate yields incorrect date

2007-02-15 Thread Peter Lauri
And what are the time zones for those two different machines? And what is
the time? :)

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Terra Frost [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 15, 2007 8:47 PM
To: php-general@lists.php.net
Subject: [PHP] plugging gmmktime value into gmdate yields incorrect date

I tried running the following script on three different servers:

?php
echo gmdate('m, d, Y', gmmktime(0,0,0,3,23,2000) );
?

On two of the servers, I got 03, 23, 2000 back.  On the other,
however, I got 03, 22, 2000.  This doesn't make any sense to me.

On the servers that return the correct date (03, 23, 2000),
gmmktime(0,0,0,3,23,2000) returns 953769600.  On the server that
returns the incorrect date (03, 22, 2000), gmmktime(0,0,0,3,23,2000)
returns 953766000.  There's a difference of 3600 between the two,
which makes me think that some daylight savings time setting is to
blame.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] plugging gmmktime value into gmdate yields incorrect date

2007-02-15 Thread Terra Frost
date('Z') on the server producing the incorrect output returns 3600.  On 
the other two, I get -18000 and -21600.


That said, I don't see how that'd make a difference.  The whole reason 
I'm using the gm* functions, in the first place, is because those are 
supposed to work with a fixed timezone - GMT.  Testament to this is the 
fact that gmdate('Z') returns 0 on all three of those.


Peter Lauri wrote:

And what are the time zones for those two different machines? And what is
the time? :)

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Terra Frost [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 15, 2007 8:47 PM

To: php-general@lists.php.net
Subject: [PHP] plugging gmmktime value into gmdate yields incorrect date

I tried running the following script on three different servers:

?php
echo gmdate('m, d, Y', gmmktime(0,0,0,3,23,2000) );
?

On two of the servers, I got 03, 23, 2000 back.  On the other,
however, I got 03, 22, 2000.  This doesn't make any sense to me.

On the servers that return the correct date (03, 23, 2000),
gmmktime(0,0,0,3,23,2000) returns 953769600.  On the server that
returns the incorrect date (03, 22, 2000), gmmktime(0,0,0,3,23,2000)
returns 953766000.  There's a difference of 3600 between the two,
which makes me think that some daylight savings time setting is to
blame.

  


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] plugging gmmktime value into gmdate yields incorrect date

2007-02-15 Thread Brad Fuller
 -Original Message-
 From: Terra Frost [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 15, 2007 3:20 PM
 To: Peter Lauri
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] plugging gmmktime value into gmdate yields incorrect
 date
 
 date('Z') on the server producing the incorrect output returns 3600.  On
 the other two, I get -18000 and -21600.
 
 That said, I don't see how that'd make a difference.  The whole reason
 I'm using the gm* functions, in the first place, is because those are
 supposed to work with a fixed timezone - GMT.  Testament to this is the
 fact that gmdate('Z') returns 0 on all three of those.
 
 Peter Lauri wrote:
  And what are the time zones for those two different machines? And what
 is
  the time? :)
 
  Best regards,
  Peter Lauri
 
  www.dwsasia.com - company web site
  www.lauri.se - personal web site
  www.carbonfree.org.uk - become Carbon Free
 
 
  -Original Message-
  From: Terra Frost [mailto:[EMAIL PROTECTED]
  Sent: Thursday, February 15, 2007 8:47 PM
  To: php-general@lists.php.net
  Subject: [PHP] plugging gmmktime value into gmdate yields incorrect date
 
  I tried running the following script on three different servers:
 
  ?php
  echo gmdate('m, d, Y', gmmktime(0,0,0,3,23,2000) );
  ?
 
  On two of the servers, I got 03, 23, 2000 back.  On the other,
  however, I got 03, 22, 2000.  This doesn't make any sense to me.
 
  On the servers that return the correct date (03, 23, 2000),
  gmmktime(0,0,0,3,23,2000) returns 953769600.  On the server that
  returns the incorrect date (03, 22, 2000), gmmktime(0,0,0,3,23,2000)
  returns 953766000.  There's a difference of 3600 between the two,
  which makes me think that some daylight savings time setting is to
  blame.
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

I may be way off... but isn't it redundant to use both gmdate() and
gmmktime()?  I thought each of these functions were used to convert your
local time into GMT...

So for example if you're GMT+5, the gmmktime() would subtract 5 hours, and
then gmdate() would subtract another 5 hours?

Like I said - I could be way off, but just a thought.

-Brad

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] plugging gmmktime value into gmdate yields incorrect date

2007-02-15 Thread Brad Fuller
 -Original Message-
 From: Brad Fuller [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 15, 2007 3:48 PM
 To: 'Terra Frost'; 'Peter Lauri'
 Cc: php-general@lists.php.net
 Subject: RE: [PHP] plugging gmmktime value into gmdate yields incorrect
 date
 
  -Original Message-
  From: Terra Frost [mailto:[EMAIL PROTECTED]
  Sent: Thursday, February 15, 2007 3:20 PM
  To: Peter Lauri
  Cc: php-general@lists.php.net
  Subject: Re: [PHP] plugging gmmktime value into gmdate yields incorrect
  date
 
  date('Z') on the server producing the incorrect output returns 3600.  On
  the other two, I get -18000 and -21600.
 
  That said, I don't see how that'd make a difference.  The whole reason
  I'm using the gm* functions, in the first place, is because those are
  supposed to work with a fixed timezone - GMT.  Testament to this is the
  fact that gmdate('Z') returns 0 on all three of those.
 
  Peter Lauri wrote:
   And what are the time zones for those two different machines? And what
  is
   the time? :)
  
   Best regards,
   Peter Lauri
  
   www.dwsasia.com - company web site
   www.lauri.se - personal web site
   www.carbonfree.org.uk - become Carbon Free
  
  
   -Original Message-
   From: Terra Frost [mailto:[EMAIL PROTECTED]
   Sent: Thursday, February 15, 2007 8:47 PM
   To: php-general@lists.php.net
   Subject: [PHP] plugging gmmktime value into gmdate yields incorrect
 date
  
   I tried running the following script on three different servers:
  
   ?php
   echo gmdate('m, d, Y', gmmktime(0,0,0,3,23,2000) );
   ?
  
   On two of the servers, I got 03, 23, 2000 back.  On the other,
   however, I got 03, 22, 2000.  This doesn't make any sense to me.
  
   On the servers that return the correct date (03, 23, 2000),
   gmmktime(0,0,0,3,23,2000) returns 953769600.  On the server that
   returns the incorrect date (03, 22, 2000), gmmktime(0,0,0,3,23,2000)
   returns 953766000.  There's a difference of 3600 between the two,
   which makes me think that some daylight savings time setting is to
   blame.
  
  
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 I may be way off... but isn't it redundant to use both gmdate() and
 gmmktime()?  I thought each of these functions were used to convert your
 local time into GMT...
 
 So for example if you're GMT+5, the gmmktime() would subtract 5 hours, and
 then gmdate() would subtract another 5 hours?
 
 Like I said - I could be way off, but just a thought.
 
 -Brad

Yes, I was a little off...

gmmktime() takes a GMT date and converts it to a local unix timestamp.
gmdate()   takes a local unix timestamp and converts it to a GMT date.

So in theory you *should* get the same date you put in, if using both
functions like your example.

I think you are on the right track with the Daylight Saving time issue.

Starting this year, DST in the U.S. begins in March instead of April.
Given that the year of your date input is 2000, it shouldn't be affected,
but perhaps that is in fact the culprit? Your date 3/23 falls in between the
previous and future DST start dates.

Hmm...

Have you gotten similar results using a different month/day?

-Brad

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] plugging gmmktime value into gmdate yields incorrect date

2007-02-15 Thread Jim Lucas

Brad Fuller wrote:

-Original Message-
From: Brad Fuller [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 15, 2007 3:48 PM
To: 'Terra Frost'; 'Peter Lauri'
Cc: php-general@lists.php.net
Subject: RE: [PHP] plugging gmmktime value into gmdate yields incorrect
date


-Original Message-
From: Terra Frost [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 15, 2007 3:20 PM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: [PHP] plugging gmmktime value into gmdate yields incorrect
date

date('Z') on the server producing the incorrect output returns 3600.  On
the other two, I get -18000 and -21600.

That said, I don't see how that'd make a difference.  The whole reason
I'm using the gm* functions, in the first place, is because those are
supposed to work with a fixed timezone - GMT.  Testament to this is the
fact that gmdate('Z') returns 0 on all three of those.

Peter Lauri wrote:

And what are the time zones for those two different machines? And what

is

the time? :)

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Terra Frost [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 15, 2007 8:47 PM
To: php-general@lists.php.net
Subject: [PHP] plugging gmmktime value into gmdate yields incorrect

date

I tried running the following script on three different servers:

?php
echo gmdate('m, d, Y', gmmktime(0,0,0,3,23,2000) );
?

On two of the servers, I got 03, 23, 2000 back.  On the other,
however, I got 03, 22, 2000.  This doesn't make any sense to me.

On the servers that return the correct date (03, 23, 2000),
gmmktime(0,0,0,3,23,2000) returns 953769600.  On the server that
returns the incorrect date (03, 22, 2000), gmmktime(0,0,0,3,23,2000)
returns 953766000.  There's a difference of 3600 between the two,
which makes me think that some daylight savings time setting is to
blame.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


I may be way off... but isn't it redundant to use both gmdate() and
gmmktime()?  I thought each of these functions were used to convert your
local time into GMT...

So for example if you're GMT+5, the gmmktime() would subtract 5 hours, and
then gmdate() would subtract another 5 hours?

Like I said - I could be way off, but just a thought.

-Brad


Yes, I was a little off...

gmmktime() takes a GMT date and converts it to a local unix timestamp.
gmdate()   takes a local unix timestamp and converts it to a GMT date.

So in theory you *should* get the same date you put in, if using both
functions like your example.

I think you are on the right track with the Daylight Saving time issue.

Starting this year, DST in the U.S. begins in March instead of April.
Given that the year of your date input is 2000, it shouldn't be affected,
but perhaps that is in fact the culprit? Your date 3/23 falls in between the
previous and future DST start dates.

Hmm...

Have you gotten similar results using a different month/day?

-Brad



if you run:

echo gmdate('I', gmmktime(0,0,0,3,23,2000) ); //Capital 'i'

I (capital i) - 1 if Daylight Savings Time, 0 otherwise.

This might help you

--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.


- Rush

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php