Re: timezone

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 15, 2013 at 11:35 AM, Larry Martell <larry.martell@xxxxxxxxx> wrote:
> On Mon, Apr 15, 2013 at 11:33 AM, Ashley Sheridan
> <ash@xxxxxxxxxxxxxxxxxxxx> 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.martell@xxxxxxxxx> wrote:
>>>
>>> On Mon, Apr 15, 2013 at 11:17 AM, Jonathan Sundquist
>>> <jsundquist@xxxxxxxxx> wrote:
>>>
>>>
>>>
>>>> On Mon, Apr 15, 2013 at 12:14 PM, Larry Martell <larry.martell@xxxxxxxxx>
>>>> 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





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux