Re: Re: I18Nv2 and internationalization
| From: | Michael Wallner | Date: | Wed, 09 Nov 2005 11:26:28 +0000 |
| Subject: | Re: Re: I18Nv2 and internationalization | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-21854@lists.php.net to get a copy of this message | ||
Hi Dan Rossi, you wrote:
> Ok are you suggesting do a setlocale then insert the given date, and
> mysql will pickup the locale u selected ?
Nope, see below :)
>
> What I am saying is, we are setting up a live webcam schedule, there
> will be people in different countries / places , so what we have to do
> in terms of adding it into the db, is from the given date input i
> suppose reformat it from a given country / country code from a country
> list. Can this package help me there add it in GMT ? I suppose once its
> in GMT I can use it to display the date in the local timezone ?
Short answer:
Store the local time of your server in the database.
Long answer:
Imagine your servers TZ is CET, and someone from NYC wants to add
a schedule. You'd need to know the users timezone so she can enter a localized
date. This cannot be guessed/negotiated so you need to ask her. Then convert
the date from the users timezone to CET to store it in the db. When you're
going to display the schedules fetch the dates with UNIX_TIMESTAMP() (or
equivalents) and display it with I18Nv2.
Yeah, it's not that easy as you might have thought in the first place,
but there may be more straight forward solutions I didn't recall yet... :)
Regards,
--
Michael - <mike(@)php.net> http://dev.iworks.at/ext-http/http-functions.html.gz