Like everything else Date or Time-like, Date::Manip handles that quite well, I think.
Date_ConvTZ
$date=&Date_ConvTZ($date);
$date=&Date_ConvTZ($date,$from);
$date=&Date_ConvTZ($date,"",$to);
$date=&Date_ConvTZ($date,$from,$to);
This converts a date (which MUST be in the format
returned by ParseDate) from one timezone to another.
If it is called with no arguments, the date is con
verted from the local timezone to the timezone speci
fied by the config variable ConvTZ (see documentation
on ConvTZ below). If ConvTZ is set to "IGNORE", no
conversion is done.
If called with $from but no $to, the timezone is con
verted from the timezone in $from to ConvTZ (of TZ if
ConvTZ is not set). Again, no conversion is done if
ConvTZ is set to "IGNORE".
If called with $to but no $from, $from defaults to
ConvTZ (if set) or the local timezone otherwise.
Although this does not seem immediately obvious, it
actually makes sense. By default, all dates that are
parsed are converted to ConvTZ, so most of the dates
being worked with will be stored in that timezone.
If Date_ConvTZ is called with both $from and $to, the
date is converted from the timezone $from to $to.
NOTE: As in all other cases, the $date returned from
Date_ConvTZ has no timezone information included as
part of it, so calling UnixDate with the "%z" format
will return the timezone that Date::Manip is working
in (usually the local timezone).
Example: To convert 2/2/96 noon PST to CST (regard
less of what timezone you are in, do the following:
$date=&ParseDate("2/2/96 noon");
$date=&Date_ConvTZ($date,"PST","CST");
Both timezones MUST be in one of the formats listed
below in the section TIMEZONES.
But read the caveats in the D::M docs; it might be slower than other solution.
--
Mike |