我想使用 perl 并从今天开始添加两天并将其输出为 unix 时间。我找到了很多关于如何将 Unix 时间转换为可读时间的信息,但我需要输出是 unix 时间。我找到了这个
my $time = time; # or any other epoch timestamp
my @months = ("Jan","Feb","Mar","Apr","May","Jun","Jul",
"Aug","Sep","Oct","Nov","Dec");
my ($sec, $min, $hour, $day,$month,$year) = (localtime($time))[0,1,2,3,4,5];
# You can use 'gmtime' for GMT/UTC dates instead of 'localtime'
print "Unix time ".$time." converts to ".$months[$month].
" ".$day.", ".($year+1900);
如何获取当前时间并添加 2 天并输出为 Unix 时间。