Leser: 19
my $date = localtime(time)
1 2 3
use DateTime; my $dt = DateTime->now; my $yesterday = $dt->clone->subtract( days => 1);
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
use DateTime; use DateTime::Format::Strptime; # string - input from user or something else my $time = '2009-11-30'; # Create a parser that can read YYYY-MM-DD Format my $parser = DateTime::Format::Strptime->new( pattern => '%Y-%m-%d', time_zone => 'Europe/Berlin', ); # Parse the String my $dt = $parser->parse_datetime($time); # Subtract one Day $dt->subtract( days => 1 ); print $dt, "\n";