[PHP] timezone

2013-04-15 Thread Larry Martell
I have a client that has an app the runs with PHP 5.1.6. They want to
upgrade to 5.3.3. First issue I ran into, they have a line of code
that is:

$deftz = date(T);

I'm getting this for that line:

[Mon Apr 15 10:44:16 2013] [error] [client 10.7.14.21] PHP Warning:
date(): It is not safe to rely on the system's timezone settings. You
are *required* to use the date.timezone setting or the
date_default_timezone_set() function. In case you used any of those
methods and you are still getting this warning, you most likely
misspelled the timezone identifier. We selected 'America/Denver' for
'MDT/-6.0/DST' instead in /home/www/itrade-dev/defs.inc on line 349

So I changed it to

$deftz = date.timezone;

and now I get:

[Mon Apr 15 10:49:35 2013] [error] [client 10.7.14.21] PHP Notice:
Use of undefined constant date - assumed 'date' in
/home/www/itrade-dev/defs.inc on line 349
[Mon Apr 15 10:49:35 2013] [error] [client 10.7.14.21] PHP Notice:
Use of undefined constant timezone - assumed 'timezone' in
/home/www/itrade-dev/defs.inc on line 349

Why is this undefined?

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



Re: [PHP] timezone

2013-04-15 Thread Jonathan Sundquist
On Mon, Apr 15, 2013 at 12:14 PM, Larry Martell larry.mart...@gmail.comwrote:

 I have a client that has an app the runs with PHP 5.1.6. They want to
 upgrade to 5.3.3. First issue I ran into, they have a line of code
 that is:

 $deftz = date(T);

 I'm getting this for that line:

 [Mon Apr 15 10:44:16 2013] [error] [client 10.7.14.21] PHP Warning:
 date(): It is not safe to rely on the system's timezone settings. You
 are *required* to use the date.timezone setting or the
 date_default_timezone_set() function. In case you used any of those
 methods and you are still getting this warning, you most likely
 misspelled the timezone identifier. We selected 'America/Denver' for
 'MDT/-6.0/DST' instead in /home/www/itrade-dev/defs.inc on line 349

 So I changed it to

 $deftz = date.timezone;

 and now I get:

 [Mon Apr 15 10:49:35 2013] [error] [client 10.7.14.21] PHP Notice:
 Use of undefined constant date - assumed 'date' in
 /home/www/itrade-dev/defs.inc on line 349
 [Mon Apr 15 10:49:35 2013] [error] [client 10.7.14.21] PHP Notice:
 Use of undefined constant timezone - assumed 'timezone' in
 /home/www/itrade-dev/defs.inc on line 349

 Why is this undefined?

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

  You need to set the default time zone in this fashion,

http://php.net/manual/en/function.date-default-timezone-set.php


Re: [PHP] timezone

2013-04-15 Thread Larry Martell
On Mon, Apr 15, 2013 at 11:17 AM, Jonathan Sundquist
jsundqu...@gmail.com wrote:



 On Mon, Apr 15, 2013 at 12:14 PM, Larry Martell larry.mart...@gmail.com
 wrote:

 I have a client that has an app the runs with PHP 5.1.6. They want to
 upgrade to 5.3.3. First issue I ran into, they have a line of code
 that is:

 $deftz = date(T);

 I'm getting this for that line:

 [Mon Apr 15 10:44:16 2013] [error] [client 10.7.14.21] PHP Warning:
 date(): It is not safe to rely on the system's timezone settings. You
 are *required* to use the date.timezone setting or the
 date_default_timezone_set() function. In case you used any of those
 methods and you are still getting this warning, you most likely
 misspelled the timezone identifier. We selected 'America/Denver' for
 'MDT/-6.0/DST' instead in /home/www/itrade-dev/defs.inc on line 349

 So I changed it to

 $deftz = date.timezone;

 and now I get:

 [Mon Apr 15 10:49:35 2013] [error] [client 10.7.14.21] PHP Notice:
 Use of undefined constant date - assumed 'date' in
 /home/www/itrade-dev/defs.inc on line 349
 [Mon Apr 15 10:49:35 2013] [error] [client 10.7.14.21] PHP Notice:
 Use of undefined constant timezone - assumed 'timezone' in
 /home/www/itrade-dev/defs.inc on line 349

 Why is this undefined?

  You need to set the default time zone in this fashion,

 http://php.net/manual/en/function.date-default-timezone-set.php

But I don't know the timezone - I'm trying to get it so I can convert
times I get from the database to a user requested timezone.

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



Re: [PHP] timezone

2013-04-15 Thread Ashley Sheridan
You don't know which timezone the server is in? That's what it wants.

Larry Martell larry.mart...@gmail.com wrote:

On Mon, Apr 15, 2013 at 11:17 AM, Jonathan Sundquist
jsundqu...@gmail.com wrote:



 On Mon, Apr 15, 2013 at 12:14 PM, Larry Martell
larry.mart...@gmail.com
 wrote:

 I have a client that has an app the runs with PHP 5.1.6. They want
to
 upgrade to 5.3.3. First issue I ran into, they have a line of code
 that is:

 $deftz = date(T);

 I'm getting this for that line:

 [Mon Apr 15 10:44:16 2013] [error] [client 10.7.14.21] PHP Warning:
 date(): It is not safe to rely on the system's timezone settings.
You
 are *required* to use the date.timezone setting or the
 date_default_timezone_set() function. In case you used any of those
 methods and you are still getting this warning, you most likely
 misspelled the timezone identifier. We selected 'America/Denver' for
 'MDT/-6.0/DST' instead in /home/www/itrade-dev/defs.inc on line 349

 So I changed it to

 $deftz = date.timezone;

 and now I get:

 [Mon Apr 15 10:49:35 2013] [error] [client 10.7.14.21] PHP Notice:
 Use of undefined constant date - assumed 'date' in
 /home/www/itrade-dev/defs.inc on line 349
 [Mon Apr 15 10:49:35 2013] [error] [client 10.7.14.21] PHP Notice:
 Use of undefined constant timezone - assumed 'timezone' in
 /home/www/itrade-dev/defs.inc on line 349

 Why is this undefined?

  You need to set the default time zone in this fashion,

 http://php.net/manual/en/function.date-default-timezone-set.php

But I don't know the timezone - I'm trying to get it so I can convert
times I get from the database to a user requested timezone.

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

Thanks,
Ash
http://www.ashleysheridan.co.uk

Re: [PHP] timezone

2013-04-15 Thread Larry Martell
On Mon, Apr 15, 2013 at 11:33 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:
 You don't know which timezone the server is in? That's what it wants.

No, I don't - this app runs in different locations all over the world.


 Larry Martell larry.mart...@gmail.com wrote:

 On Mon, Apr 15, 2013 at 11:17 AM, Jonathan Sundquist
 jsundqu...@gmail.com wrote:



 On Mon, Apr 15, 2013 at 12:14 PM, Larry Martell larry.mart...@gmail.com
 wrote:

 I have a client that has an app the runs with PHP 5.1.6. They want to
 upgrade to 5.3.3. First issue I ran into, they have a line of code
 that is:

 $deftz = date(T);

 I'm getting this for that line:

 [Mon Apr 15 10:44:16 2013] [error] [client 10.7.14.21] PHP Warning:
 date(): It is not safe to rely on the system's timezone settings. You
 are *required* to use
 the date.timezone setting or the
 date_default_timezone_set() function. In case you used any of those
 methods and you are still getting this warning, you most likely
 misspelled the timezone identifier. We selected 'America/Denver' for
 'MDT/-6.0/DST' instead in /home/www/itrade-dev/defs.inc on line 349

 So I changed it to

 $deftz = date.timezone;

 and now I get:

 [Mon Apr 15 10:49:35 2013] [error] [client 10.7.14.21] PHP Notice:
 Use of undefined constant date - assumed 'date' in
 /home/www/itrade-dev/defs.inc on line 349
 [Mon Apr 15 10:49:35 2013] [error] [client 10.7.14.21] PHP Notice:
 Use of undefined constant timezone - assumed 'timezone' in
 /home/www/itrade-dev/defs.inc on line 349

 Why is this undefined?


 You need to set the default time zone in this fashion,

 http://php.net/manual/en/function.date-default-timezone-set.php


 But I don't know the timezone - I'm trying to get it so I can convert
 times I get from the database to a user requested timezone.

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



Re: [PHP] timezone

2013-04-15 Thread Larry Martell
On Mon, Apr 15, 2013 at 11:35 AM, Larry Martell larry.mart...@gmail.com wrote:
 On Mon, Apr 15, 2013 at 11:33 AM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
 You don't know which timezone the server is in? That's what it wants.

 No, I don't - this app runs in different locations all over the world.

I found some code at php.net that does this:

date_default_timezone_set(@date_default_timezone_get());
$deftz = date('T');

And that is working for me and giving me what I need.


 Larry Martell larry.mart...@gmail.com wrote:

 On Mon, Apr 15, 2013 at 11:17 AM, Jonathan Sundquist
 jsundqu...@gmail.com wrote:



 On Mon, Apr 15, 2013 at 12:14 PM, Larry Martell larry.mart...@gmail.com
 wrote:

 I have a client that has an app the runs with PHP 5.1.6. They want to
 upgrade to 5.3.3. First issue I ran into, they have a line of code
 that is:

 $deftz = date(T);

 I'm getting this for that line:

 [Mon Apr 15 10:44:16 2013] [error] [client 10.7.14.21] PHP Warning:
 date(): It is not safe to rely on the system's timezone settings. You
 are *required* to use
 the date.timezone setting or the
 date_default_timezone_set() function. In case you used any of those
 methods and you are still getting this warning, you most likely
 misspelled the timezone identifier. We selected 'America/Denver' for
 'MDT/-6.0/DST' instead in /home/www/itrade-dev/defs.inc on line 349

 So I changed it to

 $deftz = date.timezone;

 and now I get:

 [Mon Apr 15 10:49:35 2013] [error] [client 10.7.14.21] PHP Notice:
 Use of undefined constant date - assumed 'date' in
 /home/www/itrade-dev/defs.inc on line 349
 [Mon Apr 15 10:49:35 2013] [error] [client 10.7.14.21] PHP Notice:
 Use of undefined constant timezone - assumed 'timezone' in
 /home/www/itrade-dev/defs.inc on line 349

 Why is this undefined?


 You need to set the default time zone in this fashion,

 http://php.net/manual/en/function.date-default-timezone-set.php


 But I don't know the timezone - I'm trying to get it so I can convert
 times I get from the database to a user requested timezone.

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



Re: [PHP] timezone

2013-04-15 Thread Lester Caine

Larry Martell wrote:

No, I don't - this app runs in different locations all over the world.

I found some code at php.net that does this:

date_default_timezone_set(@date_default_timezone_get());
$deftz = date('T');

And that is working for me and giving me what I need.


But do you ACTUALLY know what time zone is stored IN the database? What if te 
database was from another server?


One of the 'standards' adopted when working world wide is to ensure what is 
stored IN the database is always UTC based. So you can always compare times on 
the same consistent base. The only time you need the offset is to display a 
local time, and that is either the time local to the server, or the time local 
to the client.


The 'default' timezone is not necessarily the right one in either case ;)

--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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



Re: [PHP] timezone

2013-04-15 Thread Larry Martell
On Mon, Apr 15, 2013 at 1:59 PM, Lester Caine les...@lsces.co.uk wrote:
 Larry Martell wrote:

 No, I don't - this app runs in different locations all over the world.

 I found some code at php.net that does this:

 date_default_timezone_set(@date_default_timezone_get());
 $deftz = date('T');

 And that is working for me and giving me what I need.


 But do you ACTUALLY know what time zone is stored IN the database? What if
 te database was from another server?

 One of the 'standards' adopted when working world wide is to ensure what is
 stored IN the database is always UTC based. So you can always compare times
 on the same consistent base. The only time you need the offset is to display
 a local time, and that is either the time local to the server, or the time
 local to the client.

 The 'default' timezone is not necessarily the right one in either case ;)

I misspoke - the data in the db is in UTC. This is used to covert the
time of day on the server to the user's local timezone.

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



Re: [PHP] timezone

2013-04-15 Thread Maciek Sokolewicz

On 15-4-2013 22:12, Larry Martell wrote:

On Mon, Apr 15, 2013 at 1:59 PM, Lester Caine les...@lsces.co.uk wrote:

Larry Martell wrote:


No, I don't - this app runs in different locations all over the world.


I found some code at php.net that does this:

date_default_timezone_set(@date_default_timezone_get());
$deftz = date('T');

And that is working for me and giving me what I need.



But do you ACTUALLY know what time zone is stored IN the database? What if
te database was from another server?

One of the 'standards' adopted when working world wide is to ensure what is
stored IN the database is always UTC based. So you can always compare times
on the same consistent base. The only time you need the offset is to display
a local time, and that is either the time local to the server, or the time
local to the client.

The 'default' timezone is not necessarily the right one in either case ;)


I misspoke - the data in the db is in UTC. This is used to covert the
time of day on the server to the user's local timezone.



You are aware that the code you used is really bad practice, right? 
You're basically hiding the error no default timezone set by getting 
the default timezone, which returns an error; surpressing that error, 
providing the date_default_timezone_set function with the default value 
of date_default_timezone_get if none is defined (which there should!!), 
being UTC.


So in short, you're saying set the default timezone to the default 
timezone if no timezone is set, which I know there is not. That's very 
hard to understand for future programmers reading your code. Why not 
just set date_default_timezone_set('UTC'). It's clear, resolves the 
warning and works perfectly, instead of relying on vague defaults 
somewhere, in the hope they're set right.


On a sidenote; the reason why your original fix did not work:
$deftz = date.timezone;
Is because date.timezone is an ini setting. Not valid PHP code. And the 
error actually tells you you need to SET date.timezone, not set a 
variable TO the ini setting. In other words, you wanted date.timezone = 
UTC instead of $tz = date.timezone (which makes no sense anyway)


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



Re: [PHP] timezone

2013-04-15 Thread Larry Martell
On Mon, Apr 15, 2013 at 2:57 PM, Maciek Sokolewicz
maciek.sokolew...@gmail.com wrote:
 On 15-4-2013 22:12, Larry Martell wrote:

 On Mon, Apr 15, 2013 at 1:59 PM, Lester Caine les...@lsces.co.uk wrote:

 Larry Martell wrote:


 No, I don't - this app runs in different locations all over the world.


 I found some code at php.net that does this:

 date_default_timezone_set(@date_default_timezone_get());
 $deftz = date('T');

 And that is working for me and giving me what I need.



 But do you ACTUALLY know what time zone is stored IN the database? What
 if
 te database was from another server?

 One of the 'standards' adopted when working world wide is to ensure what
 is
 stored IN the database is always UTC based. So you can always compare
 times
 on the same consistent base. The only time you need the offset is to
 display
 a local time, and that is either the time local to the server, or the
 time
 local to the client.

 The 'default' timezone is not necessarily the right one in either case ;)


 I misspoke - the data in the db is in UTC. This is used to covert the
 time of day on the server to the user's local timezone.


 You are aware that the code you used is really bad practice, right? You're
 basically hiding the error no default timezone set by getting the default
 timezone, which returns an error; surpressing that error, providing the
 date_default_timezone_set function with the default value of
 date_default_timezone_get if none is defined (which there should!!), being
 UTC.

 So in short, you're saying set the default timezone to the default timezone
 if no timezone is set, which I know there is not. That's very hard to
 understand for future programmers reading your code. Why not just set
 date_default_timezone_set('UTC'). It's clear, resolves the warning and
 works perfectly, instead of relying on vague defaults somewhere, in the hope
 they're set right.

 On a sidenote; the reason why your original fix did not work:
 $deftz = date.timezone;
 Is because date.timezone is an ini setting. Not valid PHP code. And the
 error actually tells you you need to SET date.timezone, not set a variable
 TO the ini setting. In other words, you wanted date.timezone = UTC instead
 of $tz = date.timezone (which makes no sense anyway)

But UCT is not the timezone. When this app runs in New Mexico (where I
am) it's Mountain time. When it runs in NY it's Eastern. When it runs
in Tokyo it's JST, etc. The user has the option of setting the
timezone all times are displayed in. They can select any timezone
regardless of where they are. The app displays the last update time in
the user selected TZ. So I have to convert the time I get from the
server to that.

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



Re: [PHP] timezone

2013-04-15 Thread Maciek Sokolewicz
On 15 April 2013 23:06, Larry Martell la...@software-horizons.com wrote:

  But UCT is not the timezone. When this app runs in New Mexico (where I
 am) it's Mountain time. When it runs in NY it's Eastern. When it runs
 in Tokyo it's JST, etc. The user has the option of setting the
 timezone all times are displayed in. They can select any timezone
 regardless of where they are. The app displays the last update time in
 the user selected TZ. So I have to convert the time I get from the
 server to that.


Most servers provide UTC time regardless of the exact timezone they are
situated in and then leave it to the user to show it in the right timezone
to the user. The timezone you want to set is the timezone you GET the time
in. Not necesserily the timezone your device resides in.


Re: [PHP] timezone

2013-04-15 Thread Stuart Dallas
On Mon, Apr 15, 2013 at 10:06 PM, Larry Martell 
la...@software-horizons.com=mailto:la...@software-horizons.com; wrote:
On Mon, Apr 15, 2013 at 2:57 PM, Maciek Sokolewicz
 wrote:
 On 15-4-2013 22:12, Larry Martell wrote:

 On Mon, Apr 15, 2013 at 1:59 PM, Lester Caine  wrote:

 Larry Martell wrote:


 No, I don't - this app runs in different locations all over the world.


 I found some code at php.net that does this:

 date_default_timezone_set(@date_default_timezone_get());
 $deftz = date('T');

 And that is working for me and giving me what I need.



 But do you ACTUALLY know what time zone is stored IN the database? What
 if
 te database was from another server?

 One of the 'standards' adopted when working world wide is to ensure what
 is
 stored IN the database is always UTC based. So you can always compare
 times
 on the same consistent base. The only time you need the offset is to
 display
 a local time, and that is either the time local to the server, or the
 time
 local to the client.

 The 'default' timezone is not necessarily the right one in either case ;)


 I misspoke - the data in the db is in UTC. This is used to covert the
 time of day on the server to the user's local timezone.


 You are aware that the code you used is really bad practice, right? You're
 basically hiding the error no default timezone set by getting the default
 timezone, which returns an error; surpressing that error, providing the
 date_default_timezone_set function with the default value of
 date_default_timezone_get if none is defined (which there should!!), being
 UTC.

 So in short, you're saying set the default timezone to the default timezone
 if no timezone is set, which I know there is not. That's very hard to
 understand for future programmers reading your code. Why not just set
 date_default_timezone_set('UTC'). It's clear, resolves the warning and
 works perfectly, instead of relying on vague defaults somewhere, in the hope
 they're set right.

 On a sidenote; the reason why your original fix did not work:
 $deftz = date.timezone;
 Is because date.timezone is an ini setting. Not valid PHP code. And the
 error actually tells you you need to SET date.timezone, not set a variable
 TO the ini setting. In other words, you wanted date.timezone = UTC instead
 of $tz = date.timezone (which makes no sense anyway)

But UCT is not the timezone. When this app runs in New Mexico (where I
am) it's Mountain time. When it runs in NY it's Eastern. When it runs
in Tokyo it's JST, etc. The user has the option of setting the
timezone all times are displayed in. They can select any timezone
regardless of where they are. The app displays the last update time in
the user selected TZ. So I have to convert the time I get from the
server to th...@lsces.co.uk@gmail.com@gmail.com

You don't need to convert anything! Store as unix timestamps, and call 
date_default_timezone_set with the user's selection before you use any other 
date-related functions and everything will just work. This is not as hard as 
everyone seems to think!​​​-Stuart


​—
Sent from my leaf 
blo...@gmail.com@lsces.co.uk@gmail.com​@lsces.co.uk@gmail.com

[PHP] timezone math problem.

2010-09-16 Thread Paul Halliday
I have the following:

#!/usr/local/bin/php
?php
$offset = date(Z);
$sDate = '2010-09-16';
$sTime = '00:00:00';
$eDate = '2010-09-17';
$eTime = '00:00:00';
$tmpStart0 = date($sDate $sTime);
$tmpEnd0 = date($eDate $eTime);
$startDate = date(Y-m-d H:i:s,strtotime($tmpStart0 . - . $offset
seconds));
$endDate = date(Y-m-d H:i:s,strtotime($tmpEnd0 . - . $offset seconds));
$when = timestamp BETWEEN \$startDate\ AND \$endDate\;
echo \n$offset\n$when\n\n;
?

Which returns:

machine1 (AST) PHP 5.2.6:
-10800
timestamp BETWEEN 2010-09-16 03:00:00 AND 2010-09-17 03:00:00

machine2 (MST) PHP 5.1.6:
-21600
timestamp BETWEEN 1969-12-31 17:00:00 AND 1969-12-31 17:00:00

Aside from upgrading the second box, is there some other logic that is wrong?

Thanks.
-- 
Paul Halliday
Ideation | Individualization | Learner | Achiever | Analytical
http://www.pintumbler.org

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



[PHP] Timezone details

2009-07-03 Thread Manoj Singh
Hi All,

Is there any function in PHP which will provide me the details of any
timezone such as current time, DST, offset etc.

Thanks in advance,
Manoj


Re: [PHP] Timezone details

2009-07-03 Thread Michael A. Peters

Manoj Singh wrote:

Hi All,

Is there any function in PHP which will provide me the details of any
timezone such as current time, DST, offset etc.

Thanks in advance,
Manoj



It's called date

http://php.net/manual/en/function.date.php

The manual page on the function tells you how to get all that plus other 
groovy information.


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



[PHP] PHP timezone is unstable...

2009-03-09 Thread Dirk

Hello,

what could cause the timezone in PHP to, randomly, jump back and forth 6 
hours now and then?



from phpinfo():


date
date/time support enabled
Olson Timezone Database Version 0.system
Timezone Database internal
Default timezone America/Chicago

DirectiveLocal ValueMaster Value
date.default_latitude31.766731.7667
date.default_longitude35.233335.2333
date.sunrise_zenith90.5890.58
date.sunset_zenith90.5890.58
date.timezoneEurope/SwedenEurope/Sweden


Default timezone jumps between America/Chicago and Europe/Berlin 
while date.timezone stays Europe/Sweden all the time...



Dirk

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



[PHP] PHP timezone is unstable...

2009-03-09 Thread Dirk

Hello,

what could cause the timezone in PHP to, randomly, jump back and forth 6
hours now and then?


from phpinfo():


date
date/time support enabled
Olson Timezone Database Version 0.system
Timezone Database internal
Default timezone America/Chicago

DirectiveLocal ValueMaster Value
date.default_latitude31.766731.7667
date.default_longitude35.233335.2333
date.sunrise_zenith90.5890.58
date.sunset_zenith90.5890.58
date.timezoneEurope/SwedenEurope/Sweden


Default timezone jumps between America/Chicago and Europe/Berlin
while date.timezone stays Europe/Sweden all the time...


Dirk


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



[PHP] Re: PHP timezone is unstable...

2009-03-09 Thread Nathan Rixham

Dirk wrote:

Hello,

what could cause the timezone in PHP to, randomly, jump back and forth 6 
hours now and then?



from phpinfo():


date
date/time support enabled
Olson Timezone Database Version 0.system
Timezone Database internal
Default timezone America/Chicago

DirectiveLocal ValueMaster Value
date.default_latitude31.766731.7667
date.default_longitude35.233335.2333
date.sunrise_zenith90.5890.58
date.sunset_zenith90.5890.58
date.timezoneEurope/SwedenEurope/Sweden


Default timezone jumps between America/Chicago and Europe/Berlin 
while date.timezone stays Europe/Sweden all the time...



Dirk


you're not on multiple load balanced / dns round robin servers are you..?

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



Re: [PHP] Re: PHP timezone is unstable...

2009-03-09 Thread Dirk

Nathan Rixham wrote:

Dirk wrote:

Hello,

what could cause the timezone in PHP to, randomly, jump back and forth 
6 hours now and then?



from phpinfo():


date
date/time support enabled
Olson Timezone Database Version 0.system
Timezone Database internal
Default timezone America/Chicago

DirectiveLocal ValueMaster Value
date.default_latitude31.766731.7667
date.default_longitude35.233335.2333
date.sunrise_zenith90.5890.58
date.sunset_zenith90.5890.58
date.timezoneEurope/SwedenEurope/Sweden


Default timezone jumps between America/Chicago and Europe/Berlin 
while date.timezone stays Europe/Sweden all the time...



Dirk


you're not on multiple load balanced / dns round robin servers are you..?



no.. it's just a home server...

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



Re: [PHP] Re: PHP timezone is unstable...

2009-03-09 Thread Nathan Rixham

Dirk wrote:

Nathan Rixham wrote:

Dirk wrote:

Hello,

what could cause the timezone in PHP to, randomly, jump back and 
forth 6 hours now and then?



from phpinfo():


date
date/time support enabled
Olson Timezone Database Version 0.system
Timezone Database internal
Default timezone America/Chicago

DirectiveLocal ValueMaster Value
date.default_latitude31.766731.7667
date.default_longitude35.233335.2333
date.sunrise_zenith90.5890.58
date.sunset_zenith90.5890.58
date.timezoneEurope/SwedenEurope/Sweden


Default timezone jumps between America/Chicago and 
Europe/Berlin while date.timezone stays Europe/Sweden all the 
time...



Dirk


you're not on multiple load balanced / dns round robin servers are you..?



no.. it's just a home server...



random..
home server is windows xp or vista, when you installed the os it was set 
to locale America/Chicago (control panel, locales) you then changed it 
to Europe/Sweden - as a developer you frequently hit a key combination 
by mistake which switches locale, and php picks it up
to fix remove the extra america/chicago locale in control panel and 
problem sorted


if thats it i'll eat my hat lol

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



Re: [PHP] Re: PHP timezone is unstable...

2009-03-09 Thread Dirk

Nathan Rixham wrote:

Dirk wrote:

Nathan Rixham wrote:

Dirk wrote:

Hello,

what could cause the timezone in PHP to, randomly, jump back and 
forth 6 hours now and then?



from phpinfo():


date
date/time support enabled
Olson Timezone Database Version 0.system
Timezone Database internal
Default timezone America/Chicago

DirectiveLocal ValueMaster Value
date.default_latitude31.766731.7667
date.default_longitude35.233335.2333
date.sunrise_zenith90.5890.58
date.sunset_zenith90.5890.58
date.timezoneEurope/SwedenEurope/Sweden


Default timezone jumps between America/Chicago and 
Europe/Berlin while date.timezone stays Europe/Sweden all the 
time...



Dirk


you're not on multiple load balanced / dns round robin servers are 
you..?




no.. it's just a home server...



random..
home server is windows xp or vista, when you installed the os it was set 
to locale America/Chicago (control panel, locales) you then changed it 
to Europe/Sweden - as a developer you frequently hit a key combination 
by mistake which switches locale, and php picks it up
to fix remove the extra america/chicago locale in control panel and 
problem sorted


if thats it i'll eat my hat lol



no... it's ubuntu... mostly the timezone is correct (Europe/Berlin).. 
sometimes it goes 6 hours back... the system clock remains correct 
btw... really, only PHP is affected... i never seen anything like this...


:C

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



Re: [PHP] Re: PHP timezone is unstable...

2009-03-09 Thread Dirk

Nathan Rixham wrote:

Dirk wrote:

Nathan Rixham wrote:

Dirk wrote:

Hello,

what could cause the timezone in PHP to, randomly, jump back and 
forth 6 hours now and then?



from phpinfo():


date
date/time support enabled
Olson Timezone Database Version 0.system
Timezone Database internal
Default timezone America/Chicago

DirectiveLocal ValueMaster Value
date.default_latitude31.766731.7667
date.default_longitude35.233335.2333
date.sunrise_zenith90.5890.58
date.sunset_zenith90.5890.58
date.timezoneEurope/SwedenEurope/Sweden


Default timezone jumps between America/Chicago and 
Europe/Berlin while date.timezone stays Europe/Sweden all the 
time...



Dirk


you're not on multiple load balanced / dns round robin servers are 
you..?




no.. it's just a home server...



random..
home server is windows xp or vista, when you installed the os it was set 
to locale America/Chicago (control panel, locales) you then changed it 
to Europe/Sweden - as a developer you frequently hit a key combination 
by mistake which switches locale, and php picks it up
to fix remove the extra america/chicago locale in control panel and 
problem sorted


if thats it i'll eat my hat lol




also PHP shows the correct unix time... only the timezone is messed up 
by 6 hours now and then...


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



Re: [PHP] Timezone management

2008-03-12 Thread Jim Lucas

Lamonte H wrote:

After a while of studying different softwares,  I've still been getting
confused on how to make a timezone management script to display time in
different time zones.  Like right now im in -0600 CST GMT,  how would I
create a script that would work on any server that would allow me to display
my current time from -12 to 12 GMT in a select box so others could pick
their own time also.



Don't forget, there are a few time zones that are off by 30 minutes

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Timezone management

2008-03-12 Thread Daniel Brown
On Wed, Mar 12, 2008 at 10:50 AM, Jim Lucas [EMAIL PROTECTED] wrote:

 Lamonte H wrote:
   After a while of studying different softwares,  I've still been getting
   confused on how to make a timezone management script to display time in
   different time zones.  Like right now im in -0600 CST GMT,  how would I
   create a script that would work on any server that would allow me to 
 display
   my current time from -12 to 12 GMT in a select box so others could pick
   their own time also.
  

  Don't forget, there are a few time zones that are off by 30 minutes

You are correct, sir!

This is why you may want to check into using date(O); to check the offset.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



[PHP] Timezone management

2008-03-11 Thread Lamonte H
After a while of studying different softwares,  I've still been getting
confused on how to make a timezone management script to display time in
different time zones.  Like right now im in -0600 CST GMT,  how would I
create a script that would work on any server that would allow me to display
my current time from -12 to 12 GMT in a select box so others could pick
their own time also.


[PHP] Timezone DB update frequency

2007-05-21 Thread Rob Desbois

I am responsible for development of a product using PHP, which is
distributed as a component of the product.

How often does the timezone DB (php_timezonedb.dll) actually *need* to be
updated? We would be responsible for this task via product updates so need
to know if the default DB shipped with PHP will become unsuitable and when /
how often.

Thanks,
--rob


Re: [PHP] Timezone DB update frequency

2007-05-21 Thread Crayon Shin Chan
On Monday 21 May 2007 19:33, Rob Desbois wrote:

 How often does the timezone DB (php_timezonedb.dll) actually *need* to
 be updated? 

Whenever jurisdictions around the world change their time?

-- 
Crayon

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



Re: [PHP] Timezone offset

2007-03-29 Thread Seak, Teng-Fong
Chris wrote:
 Seak, Teng-Fong wrote:
 UK's timezone is GMT (+) while most other western European
 countries like Spain, France, Germany, etc are in GMT +1000.

 I'm sure you mean +0100 - +10 is Australia and other places ;)

Oh yes, of course +0100 instead of +1000.  Mistyping on the keypad :p


--
* Zoner PhotoStudio 8 - Your Photos perfect, shared, organised! 
www.zoner.com/zps
  You can download your free version.

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



Re: [PHP] Timezone offset

2007-03-28 Thread Tijnema !

On 3/28/07, Chris Boget [EMAIL PROTECTED] wrote:

My server's timezone is set to (GMT) Greenwish Mean Time : Dublin,
Edinburgh, Lisbon, London.  But when I echo out date( 'O' ), it's returning
the offset as +0100 and not +.  Why?  I would think that it should
return +.  Am I wrong?

thnx,
Chris


What about DST?

Tijnema


--
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] Timezone offset

2007-03-28 Thread Zoltán Németh
2007. 03. 28, szerda keltezéssel 10.24-kor Chris Boget ezt írta:
 My server's timezone is set to (GMT) Greenwish Mean Time : Dublin, 
 Edinburgh, Lisbon, London.  But when I echo out date( 'O' ), it's returning 
 the offset as +0100 and not +.  Why?  I would think that it should 
 return +.  Am I wrong?

maybe because of DST? (it summer time now which I think is +0100)

greets
Zoltán Németh

 
 thnx,
 Chris 
 

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



Re: [PHP] Timezone offset

2007-03-28 Thread Chris Boget

On 3/28/07, Chris Boget [EMAIL PROTECTED] wrote:

My server's timezone is set to (GMT) Greenwish Mean Time : Dublin,
Edinburgh, Lisbon, London.  But when I echo out date( 'O' ), it's 
returning

the offset as +0100 and not +.  Why?  I would think that it should
return +.  Am I wrong?

What about DST?


Hmm, I didn't think the UK observed DST already.  When did that happen?

thnx,
Chris 


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



Re: [PHP] Timezone offset

2007-03-28 Thread Tijnema !

On 3/28/07, Chris Boget [EMAIL PROTECTED] wrote:

 On 3/28/07, Chris Boget [EMAIL PROTECTED] wrote:
 My server's timezone is set to (GMT) Greenwish Mean Time : Dublin,
 Edinburgh, Lisbon, London.  But when I echo out date( 'O' ), it's
 returning
 the offset as +0100 and not +.  Why?  I would think that it should
 return +.  Am I wrong?
 What about DST?

Hmm, I didn't think the UK observed DST already.  When did that happen?

thnx,
Chris


DST is +1 since last saturday :)

Tijnema


--
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] Timezone offset

2007-03-28 Thread Satyam


- Original Message - 
From: Chris Boget [EMAIL PROTECTED]



My server's timezone is set to (GMT) Greenwish Mean Time : Dublin, 
Edinburgh, Lisbon, London.


There you have why, you set it to GreenwiSh, which is kind of Greenwich but 
not quite.


I think that being on the western end of Europe, those countries decided to 
adopt a more pan-European time zone, even if that does not match precisely 
their astronomical hour. That makes cross border  businesses easier by 
having common working hours.  It might also have to do with whether it is 
Savings Time or not.


I remember going to the Greenwich observatory and the big clock there didn't 
show the local time at all. (and the line carved on the floor is not 0 
longitude either, that line is more than a hundred meters east of the real 
geographical 0),


Satyam


But when I echo out date( 'O' ), it's returning the offset as +0100 and 
not +.  Why?  I would think that it should return +.  Am I wrong?


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



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.20/736 - Release Date: 
27/03/2007 16:38





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



Re: [PHP] Timezone offset

2007-03-28 Thread Satyam
Since about the US and most of the world that still do daylight savings 
started doing so, which was bout WWII.


Most of Europe does, we changed this past weekend.  We don't match the US in 
the dates, but we do it.


In the Southern Hemisphere they do it the opposite way, since summer and 
winter come in opposite months of the calendar, so time differences with 
countries in different hemispheres (north south) might move about 2 hours 
along the year.


Satyam



- Original Message - 
From: Chris Boget [EMAIL PROTECTED]

To: Tijnema ! [EMAIL PROTECTED]
Cc: PHP General php-general@lists.php.net
Sent: Wednesday, March 28, 2007 4:35 PM
Subject: Re: [PHP] Timezone offset



On 3/28/07, Chris Boget [EMAIL PROTECTED] wrote:

My server's timezone is set to (GMT) Greenwish Mean Time : Dublin,
Edinburgh, Lisbon, London.  But when I echo out date( 'O' ), it's 
returning

the offset as +0100 and not +.  Why?  I would think that it should
return +.  Am I wrong?

What about DST?


Hmm, I didn't think the UK observed DST already.  When did that happen?

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



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.20/736 - Release Date: 
27/03/2007 16:38





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



[PHP] Timezone offset

2007-03-28 Thread Chris Boget
My server's timezone is set to (GMT) Greenwish Mean Time : Dublin, 
Edinburgh, Lisbon, London.  But when I echo out date( 'O' ), it's returning 
the offset as +0100 and not +.  Why?  I would think that it should 
return +.  Am I wrong?


thnx,
Chris 


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



Re: [PHP] Timezone offset

2007-03-28 Thread Seak, Teng-Fong
Satyam wrote:
 - Original Message - From: Chris Boget [EMAIL PROTECTED]
 My server's timezone is set to (GMT) Greenwish Mean Time : Dublin,
 Edinburgh, Lisbon, London.

 There you have why, you set it to GreenwiSh, which is kind of
 Greenwich but not quite.

 I think that being on the western end of Europe, those countries
 decided to adopt a more pan-European time zone, even if that does not
 match precisely their astronomical hour. That makes cross border 
 businesses easier by having common working hours.
UK's timezone is GMT (+) while most other western European
countries like Spain, France, Germany, etc are in GMT +1000.

 It might also have to do with whether it is Savings Time or not.
This year, we all changed to DST last Sunday morning.


--
* Zoner PhotoStudio 8 - Your Photos perfect, shared, organised! 
www.zoner.com/zps
  You can download your free version.

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



Re: [PHP] Timezone offset

2007-03-28 Thread Tijnema !

On 3/28/07, Seak, Teng-Fong [EMAIL PROTECTED] wrote:

Satyam wrote:
 - Original Message - From: Chris Boget [EMAIL PROTECTED]
 My server's timezone is set to (GMT) Greenwish Mean Time : Dublin,
 Edinburgh, Lisbon, London.

 There you have why, you set it to GreenwiSh, which is kind of
 Greenwich but not quite.

 I think that being on the western end of Europe, those countries
 decided to adopt a more pan-European time zone, even if that does not
 match precisely their astronomical hour. That makes cross border
 businesses easier by having common working hours.
   UK's timezone is GMT (+) while most other western European
countries like Spain, France, Germany, etc are in GMT +1000.

 It might also have to do with whether it is Savings Time or not.
   This year, we all changed to DST last Sunday morning.

You're right... I said saturday, but it was acutally sunday:)
Saturday after midnight :)

I live in the netherlands, and in winter time my time zone is CET
(UTC/GMT + 1), now in summer time, my time zone is CEST (UTC/GMT + 2)

I think that makes all difference in the problem.

Tijnema



--
* Zoner PhotoStudio 8 - Your Photos perfect, shared, organised! 
www.zoner.com/zps
 You can download your free version.

--
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] Timezone offset

2007-03-28 Thread Chris

Seak, Teng-Fong wrote:

Satyam wrote:

- Original Message - From: Chris Boget [EMAIL PROTECTED]

My server's timezone is set to (GMT) Greenwish Mean Time : Dublin,
Edinburgh, Lisbon, London.

There you have why, you set it to GreenwiSh, which is kind of
Greenwich but not quite.

I think that being on the western end of Europe, those countries
decided to adopt a more pan-European time zone, even if that does not
match precisely their astronomical hour. That makes cross border 
businesses easier by having common working hours.

UK's timezone is GMT (+) while most other western European
countries like Spain, France, Germany, etc are in GMT +1000.


I'm sure you mean +0100 - +10 is Australia and other places ;)

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Timezone and DST

2006-01-06 Thread M

Mark Steudel wrote:

Hi All,
 
I've got a little problem where our servers are in PST but the customer

operates in Hawaii (-10 GMT). I believe I can just get the time for them by
doing something like
 
date(d H i, strtotime('now -2 hours') );
 
But here's the catch, how should I deal with day light savings ( DST) . In

hawaii they don't observer DST, but in Washington State we do.
 
We're on php 4.x so I can't use the  date_default_timezone_set

http://us2.php.net/manual/en/function.date-default-timezone-set.php  that
was added in PHP 5
 
Thanks, Mark




set TZ enviroment variable, it should point to a file containing 
timezone information for Hawaii, for example:


putenv('TZ=/usr/share/zoneinfo/US/Hawaii');

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



[PHP] Timezone and DST

2006-01-05 Thread Mark Steudel
Hi All,
 
I've got a little problem where our servers are in PST but the customer
operates in Hawaii (-10 GMT). I believe I can just get the time for them by
doing something like
 
date(d H i, strtotime('now -2 hours') );
 
But here's the catch, how should I deal with day light savings ( DST) . In
hawaii they don't observer DST, but in Washington State we do.
 
We're on php 4.x so I can't use the  date_default_timezone_set
http://us2.php.net/manual/en/function.date-default-timezone-set.php  that
was added in PHP 5
 
Thanks, Mark

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



Re: [PHP] Timezone and DST

2006-01-05 Thread Mike Tuller
Are you just displaying the time, or is this for submission in a  
database?



On Jan 5, 2006, at 12:50 PM, Mark Steudel wrote:


Hi All,

I've got a little problem where our servers are in PST but the  
customer
operates in Hawaii (-10 GMT). I believe I can just get the time for  
them by

doing something like

date(d H i, strtotime('now -2 hours') );

But here's the catch, how should I deal with day light savings  
( DST) . In

hawaii they don't observer DST, but in Washington State we do.

We're on php 4.x so I can't use the  date_default_timezone_set
http://us2.php.net/manual/en/function.date-default-timezone- 
set.php  that

was added in PHP 5

Thanks, Mark

--
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] Timezone and DST

2006-01-05 Thread Mark Steudel
Im just using it to set defaults on a QuickForm date element. 

-Original Message-
From: Mike Tuller [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 05, 2006 11:02 AM
To: Mark Steudel
Cc: php-general@lists.php.net
Subject: Re: [PHP] Timezone and DST

Are you just displaying the time, or is this for submission in a database?


On Jan 5, 2006, at 12:50 PM, Mark Steudel wrote:

 Hi All,

 I've got a little problem where our servers are in PST but the 
 customer operates in Hawaii (-10 GMT). I believe I can just get the 
 time for them by doing something like

 date(d H i, strtotime('now -2 hours') );

 But here's the catch, how should I deal with day light savings ( DST) 
 . In hawaii they don't observer DST, but in Washington State we do.

 We're on php 4.x so I can't use the  date_default_timezone_set
 http://us2.php.net/manual/en/function.date-default-timezone-
 set.php  that
 was added in PHP 5

 Thanks, Mark

 --
 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] Timezone and DST

2006-01-05 Thread Mike Tuller
I hate doing this, but you could use Javascript to use the date and time set
on the clients computer. You can't control how they have it set though.


On 1/5/06 1:13 PM, Mark Steudel [EMAIL PROTECTED] wrote:

 Im just using it to set defaults on a QuickForm date element.
 
 -Original Message-
 From: Mike Tuller [mailto:[EMAIL PROTECTED]
 Sent: Thursday, January 05, 2006 11:02 AM
 To: Mark Steudel
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Timezone and DST
 
 Are you just displaying the time, or is this for submission in a database?
 
 
 On Jan 5, 2006, at 12:50 PM, Mark Steudel wrote:
 
 Hi All,
 
 I've got a little problem where our servers are in PST but the
 customer operates in Hawaii (-10 GMT). I believe I can just get the
 time for them by doing something like
 
 date(d H i, strtotime('now -2 hours') );
 
 But here's the catch, how should I deal with day light savings ( DST)
 . In hawaii they don't observer DST, but in Washington State we do.
 
 We're on php 4.x so I can't use the  date_default_timezone_set
 http://us2.php.net/manual/en/function.date-default-timezone-
 set.php  that
 was added in PHP 5
 
 Thanks, Mark
 
 --
 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] Timezone and DST

2006-01-05 Thread Chris Boget
I've got a little problem where our servers are in PST but the 
customer operates in Hawaii (-10 GMT). I believe I can just get the 
time for them by doing something like

date(d H i, strtotime('now -2 hours') );
But here's the catch, how should I deal with day light savings ( DST) 
. In hawaii they don't observer DST, but in Washington State we do.


You can use date( 'I' ) to determine whether or not your server is
currently in DST and subtract the appropriate number of hours
accordingly...

thnx,
Chris

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



[PHP] Timezone date/time conversion

2005-08-01 Thread Chris Boget

I'm sure something like this has already been written and I'd
hate to redesign the wheel.  I've searched google but came up
empty and am wondering if any of you guys have what I am
looking for.  
Basically I need a function that will convert a time from one

time zone to another.  Such that if I passed in a timestamp and
specified that the conversion be made from CST to EST, it 
would perform the requisite calculation.  Or if I specified CST

to GMT, etc.
Does anyone have something like that?

thnx,
Chris

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



Re: [PHP] Timezone date/time conversion

2005-08-01 Thread Chris Boget

I'm sure something like this has already been written and I'd
hate to redesign the wheel.  I've searched google but came up
empty and am wondering if any of you guys have what I am
looking for.


I ended up writing my own.  Hopefully to help anyone else out
trying to do the same thing, I've included my function below.
I used the following page as a guide

http://www.timeanddate.com/library/abbreviations/timezones/

function calculateTimeZoneDate( $dateTime, $fromTZ, $toTZ, $fromLocation = 
'North America', $toLocation = 'GMT' ) {


 $retval = $dateTime;
 $timeStamp  = strtotime( $dateTime );

 $timeZonesArray = array( 'GMT' = array( 'GMT' = +0 // GMT
 ),
  'North America'  = array( 'NST' = -3.5, // 
Newfoundland Standard Time
 'NDT' = -2.5, // 
Newfoundland Daylight Time
 'AST' = -4, // 
Atlantic Standard Time
 'ADT' = -3, // 
Atlantic Daylight Time
 'EST' = -5, // 
Eastern Standard Time
 'EDT' = -4, // 
Eastern Daylight Time
 'CST' = -6, // 
Central Standard Time
 'CDT' = -5, // 
Central Daylight Time
 'MST' = -7, // 
Central Daylight Time
 'MDT' = -6, // 
Mountain Daylight Time
 'PST' = -8, // 
Pacific Standard Time
 'PDT' = -7, // 
Pacific Daylight Time
 'AKST' = -9, // 
Alaska Standard Time
 'AKDT' = -8, // 
Alaska Daylight Time
 'HAST' = -10, // 
Hawaii-Aleutian Standard Time
 'HADT' = -9 // 
Hawaii-Aleutian Daylight Time

 ),
  'Australia'  = array( 'NFT' = +11.5, // 
Norfolk (Island) Time
 'EST' = +10, // 
Eastern Standard Time
 'EDT' = +11, // 
Eastern Daylight Time
 'CST' = +9.5, // 
Central Standard Time
 'CDT' = +10.5, // 
Central Daylight Time
 'WST' = +8, // 
Western Standard Time
 'CXT' = +7, // 
Christmas Island Time

 ),
  'Europe' = array( 'GMT' = +0, // 
Greenwich Mean Time
 'BST' = +1, // 
British Summer Time
 'IST' = +1, // Irish 
Summer Time
 'WET' = +0, // 
Western European Time
 'WEST' = +1, // 
Western European Summer Time
 'CET' = +1, // 
Central European Time
 'CEST' = +2, // 
Central European Summer Time
 'EET' = +2, // 
Eastern European Time
 'EEST' = +3 // 
Eastern European Summer Time

 ),
  'Military'   = array( 'Z' = +0, // Zulu 
Time Zone
 'Y' = -12, // Yankee 
Time Zone
 'X' = -11, // X-ray 
Time Zone
 'W' = -10, // Whiskey 
Time Zone
 'V' = -9, // Victor 
Time Zone
 'U' = -8, // Uniform 
Time Zone
 'T' = -7, // Tango 
Time Zone
 'S' = -6, // Sierra 
Time Zone
 'R' = -5, // Romeo 
Time Zone
 'Q' = -4, // Quebec 
Time Zone
 'P' = -3, // Papa 
Time Zone
 'O' = -2, // Oscar 
Time Zone
 'N' = -1, // November 
Time Zone
 

[PHP] Timezone

2004-10-27 Thread Victor C.
Is there a way to get PHP to display the full name of time zone?
date(t) only displays in the format of 'EDT', 'PDT', etc.. But I need the
full name of the timezone, ie. Pacific daylight saving time.
I know I can hard code all of these using switch statemetns.  I'm just
wondering if there is a function that's already build in.

Thanks

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



[PHP] Timezone and time() and date()

2004-01-07 Thread Manuel Vázquez Acosta
Hi all:

How does the timezone of the server affects the behavior of the functions
time and date.

Manu.

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



Re: [PHP] Timezone and time() and date()

2004-01-07 Thread Richard Davey
Hello Manuel,

Wednesday, January 7, 2004, 5:48:27 PM, you wrote:

MVA How does the timezone of the server affects the behavior of the functions
MVA time and date.

Quite simply, if you don't provide date() with a timestamp then it
will use the local servers timestamp instead. This will be whatever
the operating system is configured to be.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



[PHP] Timezone functions?

2003-06-30 Thread Mark McCulligh
I am working on a project that I have to convert the date/time to different
timezone include daylight saving time (DST).  This project will be on a
Windows server for a lot of the functions I have found on PHP.net don't work
right.

I am storing all the dates on the database in GMT time, thus I take the
users input dates and convert them to GMT based on their timezone. Plus
convert from GMT to their timezone.  I would also like a function that can
tell me to offset with DST.  Example; I give it EST it would right now
return -4, not -5 because of DST.

I have looked a the PEAR Date_TimeZone class, it looks good, but there is no
doc or examples on how to use it.

Can someone recommend some good functions to using, that work on a windows
platform.

Thanks, Mark.



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



Re: [PHP] timezone problem

2002-05-21 Thread Baba Buehler

Miguel Cruz wrote:
 
 In short, I believe it's an OS rather than a PHP thing.
 

time zones can be a messy and tricky beast.  all the PHP functions rely on 
the underlying OS implementation of time zone information.  sometimes this 
is controlled by the TZ environment variable, sometimes it is not.

my solution was to extract as much info as reasonable from the zoneinfo 
database and manipulate it in PHP directly.  the solution is not perfect, 
but is probably the best that can be done without more PHP access to the 
underlying zoneinfo implementation.

my code (with all the time zone data  zone IDs) is in PEAR:
http://pear.php.net/package-info.php?pacid=57


thanks,
baba


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




RE: [PHP] timezone problem

2002-05-21 Thread SP

Hi Baba

I've been trying to get as much info on this as
possible and you are right it is quite messy.
Thanks for that link, I'm going to take a look at
your code.



-Original Message-
From: Baba Buehler [mailto:[EMAIL PROTECTED]]
Sent: May 21, 2002 5:37 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] timezone problem


Miguel Cruz wrote:

 In short, I believe it's an OS rather than a PHP
thing.


time zones can be a messy and tricky beast.  all
the PHP functions rely on
the underlying OS implementation of time zone
information.  sometimes this
is controlled by the TZ environment variable,
sometimes it is not.

my solution was to extract as much info as
reasonable from the zoneinfo
database and manipulate it in PHP directly.  the
solution is not perfect,
but is probably the best that can be done without
more PHP access to the
underlying zoneinfo implementation.

my code (with all the time zone data  zone IDs)
is in PEAR:
http://pear.php.net/package-info.php?pacid=57


thanks,
baba


--
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] timezone problem

2002-05-21 Thread Christopher Riordan

I had a similar issue, for a thing I'm doing for a Messageboard I am writing
I need the timezones and offsets, so I compiled the best I could off
different sites and info, and created a Mysql Table with all the timezones
and offsets. there are duplicate offsets but since people know their TZ as
different things depending where they live. I can do a dump if people would
like


Chris Riordan
http://www.hal-9000.net


- Original Message -
From: SP [EMAIL PROTECTED]
To: Baba Buehler [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, May 21, 2002 12:47 PM
Subject: RE: [PHP] timezone problem


 Hi Baba

 I've been trying to get as much info on this as
 possible and you are right it is quite messy.
 Thanks for that link, I'm going to take a look at
 your code.



 -Original Message-
 From: Baba Buehler [mailto:[EMAIL PROTECTED]]
 Sent: May 21, 2002 5:37 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] timezone problem


 Miguel Cruz wrote:
 
  In short, I believe it's an OS rather than a PHP
 thing.
 

 time zones can be a messy and tricky beast.  all
 the PHP functions rely on
 the underlying OS implementation of time zone
 information.  sometimes this
 is controlled by the TZ environment variable,
 sometimes it is not.

 my solution was to extract as much info as
 reasonable from the zoneinfo
 database and manipulate it in PHP directly.  the
 solution is not perfect,
 but is probably the best that can be done without
 more PHP access to the
 underlying zoneinfo implementation.

 my code (with all the time zone data  zone IDs)
 is in PEAR:
 http://pear.php.net/package-info.php?pacid=57


 thanks,
 baba


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





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




RE: [PHP] timezone problem

2002-05-21 Thread SP

Here's what I was just thinking.  This timezone
seems too complicated and what do you guys think
about me just displaying all the times in GMT and
then allow the user to set to their local time by
selecting a pulldown list of all the times GMT -11
to GMT +12.

set local time to 1:10pm
set local time to 2:10pm
set local time to 3:10pm
set local time to 4:10pm
.
.
.

They would have to change their settings once a
year for day light savings but the good thing is I
don't have to worry about tz anymore.  What do you
think?


-Original Message-
From: Christopher Riordan
[mailto:[EMAIL PROTECTED]]
Sent: May 21, 2002 1:05 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] timezone problem


I had a similar issue, for a thing I'm doing for a
Messageboard I am writing
I need the timezones and offsets, so I compiled
the best I could off
different sites and info, and created a Mysql
Table with all the timezones
and offsets. there are duplicate offsets but since
people know their TZ as
different things depending where they live. I can
do a dump if people would
like


Chris Riordan
http://www.hal-9000.net


- Original Message -
From: SP [EMAIL PROTECTED]
To: Baba Buehler [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Tuesday, May 21, 2002 12:47 PM
Subject: RE: [PHP] timezone problem


 Hi Baba

 I've been trying to get as much info on this as
 possible and you are right it is quite messy.
 Thanks for that link, I'm going to take a look
at
 your code.



 -Original Message-
 From: Baba Buehler [mailto:[EMAIL PROTECTED]]
 Sent: May 21, 2002 5:37 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] timezone problem


 Miguel Cruz wrote:
 
  In short, I believe it's an OS rather than a
PHP
 thing.
 

 time zones can be a messy and tricky beast.  all
 the PHP functions rely on
 the underlying OS implementation of time zone
 information.  sometimes this
 is controlled by the TZ environment variable,
 sometimes it is not.

 my solution was to extract as much info as
 reasonable from the zoneinfo
 database and manipulate it in PHP directly.  the
 solution is not perfect,
 but is probably the best that can be done
without
 more PHP access to the
 underlying zoneinfo implementation.

 my code (with all the time zone data  zone IDs)
 is in PEAR:
 http://pear.php.net/package-info.php?pacid=57


 thanks,
 baba


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





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




[PHP] timezone problem

2002-05-20 Thread SP

I am trying to convert date/times to different
timezones using putenv but I am having problems
using the right TZ names.  I am trying the zones I
found here
http://fuck.org/~ryan/squirrel/timezone/timezones.
php but it seems the only ones that work are
EST5EDT, CST6CDT, MST7MDT, PST8PDT and GMT.

OUTPUT
===

May 20 2002 10:46 am Eastern Standard Time
May 20 2002 3:46 pm Ame
May 20 2002 3:46 pm Ame
May 20 2002 10:46 am EST
May 20 2002 2:46 pm GMT
May 20 2002 3:46 pm Eur
May 20 2002 3:46 pm Asi

CODE
=

echo date(F j Y g:i a T), br;

putenv(TZ=America/Los_Angeles);
echo date(F j Y g:i a T), br;

putenv(TZ=America/New_York);
echo date(F j Y g:i a T), br;

putenv(TZ=EST5EDT);
echo date(F j Y g:i a T), br;

putenv(TZ=GMT);
echo date(F j Y g:i a T), br;

putenv(TZ=Europe/Paris);
echo date(F j Y g:i a T), br;

putenv(TZ=Asia/Hong_Kong);
echo date(F j Y g:i a T), br;



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system
(http://www.grisoft.com).
Version: 6.0.361 / Virus Database: 199 - Release
Date: 07/05/02
 



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


Re: [PHP] timezone problem

2002-05-20 Thread Miguel Cruz

I think these are system-specific. You'll probably have to check which 
time zone your machine understands. For instance, on this FreeBSD machine 
there are hundreds of them in /usr/share/zoneinfo but on other machines 
there are only a handful.

In short, I believe it's an OS rather than a PHP thing.

miguel

On Mon, 20 May 2002, SP wrote:
 I am trying to convert date/times to different
 timezones using putenv but I am having problems
 using the right TZ names.  I am trying the zones I
 found here
 http://fuck.org/~ryan/squirrel/timezone/timezones.
 php but it seems the only ones that work are
 EST5EDT, CST6CDT, MST7MDT, PST8PDT and GMT.
 
 OUTPUT
 ===
 
 May 20 2002 10:46 am Eastern Standard Time
 May 20 2002 3:46 pm Ame
 May 20 2002 3:46 pm Ame
 May 20 2002 10:46 am EST
 May 20 2002 2:46 pm GMT
 May 20 2002 3:46 pm Eur
 May 20 2002 3:46 pm Asi
 
 CODE
 =
 
 echo date(F j Y g:i a T), br;
 
 putenv(TZ=America/Los_Angeles);
 echo date(F j Y g:i a T), br;
 
 putenv(TZ=America/New_York);
 echo date(F j Y g:i a T), br;
 
 putenv(TZ=EST5EDT);
 echo date(F j Y g:i a T), br;
 
 putenv(TZ=GMT);
 echo date(F j Y g:i a T), br;
 
 putenv(TZ=Europe/Paris);
 echo date(F j Y g:i a T), br;
 
 putenv(TZ=Asia/Hong_Kong);
 echo date(F j Y g:i a T), br;
 
 
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system
 (http://www.grisoft.com).
 Version: 6.0.361 / Virus Database: 199 - Release
 Date: 07/05/02
  
 
 


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




RE: [PHP] timezone problem

2002-05-20 Thread SP

hi miguel

i'm testing on a windows so not sure where the
timezone info would be but what you are saying
that if i port my app to a unix box then it would
be easy to just add the missing timezones in
/usr/share/zoneinfo, right?  if that's the case
then i could just test with pacific, eastern and
mountain time for now.

also, do you know if i store all my dates as GMT
then when i convert to different timezones using
putenv, will this take into account the daylight
savings?



-Original Message-
From: Miguel Cruz [mailto:[EMAIL PROTECTED]]
Sent: May 20, 2002 1:27 PM
To: SP
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] timezone problem


I think these are system-specific. You'll probably
have to check which
time zone your machine understands. For instance,
on this FreeBSD machine
there are hundreds of them in /usr/share/zoneinfo
but on other machines
there are only a handful.

In short, I believe it's an OS rather than a PHP
thing.

miguel

On Mon, 20 May 2002, SP wrote:
 I am trying to convert date/times to different
 timezones using putenv but I am having problems
 using the right TZ names.  I am trying the zones
I
 found here

http://fuck.org/~ryan/squirrel/timezone/timezones.
 php but it seems the only ones that work are
 EST5EDT, CST6CDT, MST7MDT, PST8PDT and GMT.

 OUTPUT
 ===

 May 20 2002 10:46 am Eastern Standard Time
 May 20 2002 3:46 pm Ame
 May 20 2002 3:46 pm Ame
 May 20 2002 10:46 am EST
 May 20 2002 2:46 pm GMT
 May 20 2002 3:46 pm Eur
 May 20 2002 3:46 pm Asi

 CODE
 =

 echo date(F j Y g:i a T), br;

 putenv(TZ=America/Los_Angeles);
 echo date(F j Y g:i a T), br;

 putenv(TZ=America/New_York);
 echo date(F j Y g:i a T), br;

 putenv(TZ=EST5EDT);
 echo date(F j Y g:i a T), br;

 putenv(TZ=GMT);
 echo date(F j Y g:i a T), br;

 putenv(TZ=Europe/Paris);
 echo date(F j Y g:i a T), br;

 putenv(TZ=Asia/Hong_Kong);
 echo date(F j Y g:i a T), br;



 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system
 (http://www.grisoft.com).
 Version: 6.0.361 / Virus Database: 199 - Release
 Date: 07/05/02





---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system
(http://www.grisoft.com).
Version: 6.0.361 / Virus Database: 199 - Release
Date: 07/05/02

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system
(http://www.grisoft.com).
Version: 6.0.361 / Virus Database: 199 - Release
Date: 07/05/02


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




RE: [PHP] timezone problem

2002-05-20 Thread Miguel Cruz

On Mon, 20 May 2002, SP wrote:
 i'm testing on a windows so not sure where the timezone info would be
 but what you are saying that if i port my app to a unix box then it
 would be easy to just add the missing timezones in /usr/share/zoneinfo,
 right?  if that's the case then i could just test with pacific, eastern
 and mountain time for now.

I'm not sure about the file format for those time zones - it seems to be 
some weird binary format. But hopefully your server will have a full 
complement available.

 also, do you know if i store all my dates as GMT then when i convert to
 different timezones using putenv, will this take into account the
 daylight savings?

Yup.

miguel


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