perl获取日起和时间
注意:localtime获取的年份是相对于1900的偏移,需要加上1900,而localtime获取的month范围是0-11,需要加1。
my ($sec,$min,$hour,$day,$mon,$year,$wday,$yday,$isdst) = localtime();
$year += 1900;
$mon++;
my $date = "$year-$mon-$day";
print $date, "\n";
==
注意:localtime获取的年份是相对于1900的偏移,需要加上1900,而localtime获取的month范围是0-11,需要加1。
my ($sec,$min,$hour,$day,$mon,$year,$wday,$yday,$isdst) = localtime();
$year += 1900;
$mon++;
my $date = "$year-$mon-$day";
print $date, "\n";
==