note 26847 modified in function.strftime by rasmus

From: Date: Wed, 11 Jun 2003 01:41:23 +0000
Subject: note 26847 modified in function.strftime by rasmus
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-50143@lists.php.net to get a copy of this message
If you are building a web app that will be used by people different timezones from the server on which the app is running, you can switch the timezone on the fly by doing the following before calling strftime (), or the other timestamp processing functions. This is very easy if you know how to do it. If you don't you'll spend hours trying to manually slide timestamps around. putenv ("TZ=PST8PDT"); print strftime ("%T %Z"); putenv ("TZ=EST5EDT"); print strftime ("%T %Z"); Valid timezone codes can (usually) be seen (on Linux, at least) in /usr/share/zoneinfo or /usr/lib/zoneinfo (according to the tzset manpage). --was-- If you are building a web app that will be used by people different timezones from the server on which the app is running, you can switch the timezone on the fly by doing the following before calling strftime (), or the other timestamp processing functions. This is very easy if you know how to do it. If you don't you'll spend hours trying to manually slide timestamps around. putenv ("TZ=PST8PDT"); print strftime ("%T %Z"); putenv ("TZ=EST8EDT"); print strftime ("%T %Z"); Valid timezone codes can (usually) be seen (on Linux, at least) in /usr/share/zoneinfo or /usr/lib/zoneinfo (according to the tzset manpage). http://www.php.net/manual/en/function.strftime.php

« previous php.notes (#50143) next »