I guess I'm just not very good at explaining the feature. If I have a
formatter that is related to a time_zone then I feel that input and output
of that formatter should be able to be based on that time zone.
my $Strp = new DateTime::Format::Strptime(
pattern => '%T',
locale => 'en_AU',
time_zone => 'Australia/Melbourne',
format_with_time_zone => 1
);
my $Strp2 = new DateTime::Format::Strptime(
pattern => '%T',
locale => 'en_AU',
time_zone => 'Australia/Melbourne',
);
my $dt = DateTime->now; #DateTime in UTC
print $Strp->format_datetime($dt)
# prints $dt in the specified format after converting a clone to
Australia/Melbourne time_zone
# it formats the output taking into account the time_zone parameter if it
exists, hence: 'format_with_time_zone => 1'
print $Strp2->format_datetime($dt)
# prints $dt in UTC, normal use no conversion of a cloned object
You are specifically telling the module to output using the time_zone you
already provided so I don't see how it's a 'bad idea'.
On Tue, Dec 15, 2009 at 4:38 PM, Evan Carroll <[email protected]> wrote:
> > Basically I have a subclass of DateTime::Format::Strptime that takes one
> > more parameter; a boolean that if true will format the datetime object
> with
> > what is returned from time_zone.
>
> This sounds like a bad idea, because you made note that you're doing
> this on format_datetime, time_zone by convention is what the input is
> read to be, not what it should be outputed as.
>
> --
> Evan Carroll
> System Lord of the Internets
> http://www.evancarroll.com
>