Re: timezone
| From: | Larry Martell | Date: | Mon, 15 Apr 2013 17:23:41 +0000 |
| Subject: | Re: timezone | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-320850@lists.php.net to get a copy of this message | ||
On Mon, Apr 15, 2013 at 11:17 AM, Jonathan Sundquist
<jsundquist@gmail.com> wrote:
>
>
>
> On Mon, Apr 15, 2013 at 12:14 PM, Larry Martell <larry.martell@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.