Hi,

I was (only kind of) expecting the program below to have this output:

$ perl time.pl
Mon Aug 28 2006 12:00 pm PDT
Wed Aug 30 2006 12:00 pm PST

Will someone please explain why this is the output (Note PDT for the date 
that does not fall within PDT)? Is there a document that suggests how I 
could get the desired behavior?

$ perl time.pl
Mon Aug 28 2006 12:00 pm PDT
Wed Aug 30 2006 12:00 pm PDT

$ cat time.pl
use DateTime::Format::Strptime;

my $outfmt = '%a %b %d %Y %l:%M %P %Z';
my $infmt = '%Y/%m/%d %H:%M';

my $parser = DateTime::Format::Strptime->new(
  pattern     => $infmt,
  time_zone   => 'America/Los_Angeles',
);

my $pdt = $parser->parse_datetime('2006/08/28 12:00');
my $pst = $parser->parse_datetime('2006/08/30 12:00');

print $pdt->strftime($outfmt), "\n";
print $pst->strftime($outfmt), "\n";

Thank you,

Todd W.


Reply via email to