perl 时间处理

#!/usr/bin/perl
use POSIX qw(strftime);
 
 
my $day_Ymd = strftime("%Y%m%d", localtime(time - 86400 * $days));
my $day_ymd = strftime("%y%m%d", localtime(time - 86400 * $days));
print $day_Ymd,"/n";

my $showdate=`date -d '$i days ago' +%d/%b`;
chomp $showdate;
my $realdate=`date -d '$i days ago' +%Y%m%d`;
chomp $realdate;
print $showdate,"/n";

my  ($sec,$min,$hour,$mday,$mon,$year) = (localtime)[0..5];
print $year,"/n";

你可能感兴趣的:(Date,perl)