Re: AW: AW: change timezone // Zeitzone dndern
On Fri, 23 Jan 2004, Dominique Dumont wrote:
> "Stefan Schmidt" <UnknownX@gmx.de> writes:
>
> > so i want to convert
> > "2004-01-21 22:46:00" which maybe is GMT
> > to
> > "2004-01-21 24:46:00" => MET
>
> You should try Date::Calc (the swiss army knife date calculation module).
>
> >From the man page:
>
> o "($D_y,$D_m,$D_d, $Dh,$Dm,$Ds, $dst) = Timezone([time]);"
>
> This function returns the difference between ""localtime(time)"" and
> ""gmtime(time)"", which is the timezone offset in effect for the cur-
> rent location and the given ""time"".
>
> This offset is positive if you are located to the east of Greenwich,
> and is usually negative (except during daylight savings time, in some
> locations) if you are located to the west of Greenwich.
>
> Note that this offset is influenced by all of the relevant system
> settings and parameters on your machine; such as locales, environment
> variables (e.g. ""TZ"") and the system clock itself. See the relevant
> documentation on your system for more details.
This is a terrible solution if you need to work with more than just UTC
(aka GMT) and one other time zone. For example, if you need to present
datetimes to users in a web app and the users may be in any time zone,
then Date::Calc will be very painful to use.
This was one of the motivations for writing DateTime.
-dave
/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/
Reply to: