Re: [PHP] date("H", $datevalue) always adds an hour?

2006-01-20 Thread Michael Hulse

Hi,

On Jan 20, 2006, at 2:24 AM, Murray @ PlanetThoughtful wrote:

Can anyone help me figure out how to accommodate for this?


Not sure if this will help, but:

# Set time zone:
putenv('TZ=US/Pacific'); // I am on west-coast, my servers are on east, 
if not for this code the timestamp used in my script will reley upon 
the server time. This line of code will over-ride server time.


Maybe look-up putenv on php.net and read-up in the comments section, I 
usually find good info that way.


Gl,
Cheers,
Micky

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



Re: [PHP] date("H", $datevalue) always adds an hour?

2006-01-20 Thread Richard Lynch
On Fri, January 20, 2006 4:24 am, Murray @ PlanetThoughtful wrote:
> Wondering if anyone can help me work out why date("H") always adds an
> hour? I'm *assuming* it thinks it should be compensating for Daylight
> Saving Time (though I'd be just as willing to believe that it's caused
> by something else), however we don't observe DST in Queensland,
> Australia.
>
> Making matters a little more complex, while my local machine shouldn't
> be compensating for DST (if that's what's happening), my remote
> machine
> (based in Florida somewhere, I think) should, when applicable.
>
> So, just to explain a little better.
>
> Let's say the clock on my computer reads 7:00pm. If I do "echo
> date("H");" it will output "20", instead of "19".
>
> The same thing happens if I take a date value from my mysql database.
>
> $sql = "SELECT UNIX_TIMESTAMP(datecreated) AS unx_date FROM mytable;"
> $rs = mysql_query($sql);
> $row = mysql_fetch_object($rs);
> echo date("H", $row->unx_date);
>
> If the above record contained the value '2006-01-10 19:00', the code
> would output "20" instead of "19".
>
> Can anyone help me figure out how to accommodate for this?

Ah, the joys of time-zones, and daylight savings.

I'd like to kill the guy that thought up daylight savings.

Not only does it depend on the machine's location, and where the
machine thinks it's located (you could lie to your computer, you know)
but also the 'locale' settings and the BIOS UTC setting, and the
server's settings in the OS and/or NTP client and...

Oh, plus with MySQL, there are settings that can convince MySQL to not
pay attention to the OS about its locale/zone settings and to do
someting else instead.

Tracking down where the fault lies is generally "not fun"

But at least now you know where to look :-)

I usually throw my hands up in despair and just add/subtract whatever,
and then check it again when daylight savings changes over and see if
it still works -- Because I have zero control over any of the settings
on a shared server anyway.

And what's up with these countries with time-zones offset by 15
minutes?  What were they thinking?

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] date("H", $datevalue) always adds an hour?

2006-01-20 Thread Silvio Porcellana [tradeOver]

David Grant wrote:

Murray,

I can't think what else it might be.  Sorry!

David


What does

date("I", $datevalue)

return? (it's a capital 'i')

I guess you already checked out this page...
http://php.net/date

--
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] date("H", $datevalue) always adds an hour?

2006-01-20 Thread David Grant
Murray,

I can't think what else it might be.  Sorry!

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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



Re: [PHP] date("H", $datevalue) always adds an hour?

2006-01-20 Thread Murray @ PlanetThoughtful

On 20/01/2006 8:48 PM, David Grant wrote:

Murray,

As far as I know, Queensland is in EST (Eastern Standard Time), so that
is the correct value.  Are you using the same machine or is it remote?

David
  

Hi David,

I'm currently working entirely on my local (Queensland) machine. The 
remote machine only becomes an issue when I'm finished putting the site 
together.


Thanks for giving this some thought...

Murray

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



Re: [PHP] date("H", $datevalue) always adds an hour?

2006-01-20 Thread David Grant
Murray,

As far as I know, Queensland is in EST (Eastern Standard Time), so that
is the correct value.  Are you using the same machine or is it remote?

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] date("H", $datevalue) always adds an hour?

2006-01-20 Thread Murray @ PlanetThoughtful

On 20/01/2006 8:39 PM, David Grant wrote:

Murray,

What do you get if you print date("T")?

David
  

Hi David,

I get "EST", which I assume is "Eastern Savings Time"? If that's the 
case, any idea where I change this value so that it only affects my 
local machine?


Much warmth,

Murray

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



Re: [PHP] date("H", $datevalue) always adds an hour?

2006-01-20 Thread David Grant
Murray,

What do you get if you print date("T")?

David
-- 
David Grant
http://www.grant.org.uk/

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



[PHP] date("H", $datevalue) always adds an hour?

2006-01-20 Thread Murray @ PlanetThoughtful

Hi All,

Wondering if anyone can help me work out why date("H") always adds an 
hour? I'm *assuming* it thinks it should be compensating for Daylight 
Saving Time (though I'd be just as willing to believe that it's caused 
by something else), however we don't observe DST in Queensland, Australia.


Making matters a little more complex, while my local machine shouldn't 
be compensating for DST (if that's what's happening), my remote machine 
(based in Florida somewhere, I think) should, when applicable.


So, just to explain a little better.

Let's say the clock on my computer reads 7:00pm. If I do "echo 
date("H");" it will output "20", instead of "19".


The same thing happens if I take a date value from my mysql database.

$sql = "SELECT UNIX_TIMESTAMP(datecreated) AS unx_date FROM mytable;"
$rs = mysql_query($sql);
$row = mysql_fetch_object($rs);
echo date("H", $row->unx_date);

If the above record contained the value '2006-01-10 19:00', the code 
would output "20" instead of "19".


Can anyone help me figure out how to accommodate for this?

Much warmth,

Murray

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