Re: adjusting time() to correct for time zones

From: Date: Fri, 24 May 2002 20:29:42 +0000
Subject: Re: adjusting time() to correct for time zones
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-99145@lists.php.net to get a copy of this message
On Fri, 24 May 2002, John Hughes wrote: > My server is located on the East Coast, but all of the users of my > site live on the West Coast. I have an application that makes several > calls to time() and as a result all of the times displayed are East > Coast. > > Rather than changing every time() to time()-10800, I was wondering if > there is a way to make one global change, perhaps with .htacess. > Since this site is hosted on a commercial service I do not have > access to the PHP.ini or other server-level files. How about writing a wrapper function called l_time() that does the calculation for you? Stick it in an include file, do a little searchin'-and-replacin', and you're set. One day when you get ambitious you can enhance the l_time() function to look for a cookie that identifies the current user's time zone and calculates accordingly. miguel

« previous php.general (#99145) next »