Re: timezone

From: Date: Mon, 15 Apr 2013 20:12:29 +0000
Subject: Re: timezone
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-320855@lists.php.net to get a copy of this message
On Mon, Apr 15, 2013 at 1:59 PM, Lester Caine <lester@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.

« previous php.general (#320855) next »