Re: [PHP] timezone

[email protected] (Larry Martell)
Newsgroups php.general
Message-ID <CACwCsY4ZuCAXXNdtiQgm9MbrjjabHeimSBeZh9L3teqKasu0kg@mail.gmail.com>
On Mon, Apr 15, 2013 at 1:59 PM, Lester Caine <[email protected]> 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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.