Perl日期处理

[root@june2 ~]# cat 2.pl 
use POSIX qw(strftime);
my $yesterday = strftime "%Y-%m-%d", localtime(time-86400);
my $today =  strftime "%Y-%m-%d", localtime;
my $tomorrow = strftime "%Y-%m-%d", localtime(time+86400);
print "$yesterday is $yesterday
";
print "$today is $today
";
print "$tomorrow is $tomorrow
";
[root@june2 ~]# perl 2.pl 
$yesterday is 2014-04-13
$today is 2014-04-14
$tomorrow is 2014-04-15

原文地址:https://www.cnblogs.com/hzcya1995/p/13351955.html