On Tue, Dec 15, 2009 at 7:28 AM, Kevin McGrath <kmcgr...@baknet.com> wrote:
> Here is my situation.  I use the Rose Framework as my ORM under mod_perl,
> fast_cgi, and server_side scripts.  I have the framework set up to use UTC
> to store all datetimes.  I do all work in my controllers in UTC time.  The
> majority of the time I need a datetime to be converted to a specific
> time_zone is when it is being displayed to a user.
>
> Doing the work in parse_datetime does not work for me.  In fact I almost
> never call parse_datetime directly and when I do it's to get the datetime
> passed in from a form into UTC.  I need/want the time_zone conversion to
> also happen within the format_datetime function when necessary.
>
> The idea is that I should be able to have 1 datetime object that has already
> be created in UTC and easily show that same datetime object to multiple
> users in the pattern and time_zone they prefer.

It is an interesting idea, but the traditional DateTime::Format
convention for format_datetime does not include timezone math already
done through $dt->set_time_zone( $tz ). If you had a variable output
pattern dependent on the timezone I could see the need, it is very
easily done too using DateTimeX::Format

my $dt = parse_datetime( ... );
$dt->set_time_zone( $tz );
format_datetime($dt);

-- 
Evan Carroll
System Lord of the Internets

Reply via email to