我正在尝试在当前时间上增加一个小时,但出现错误。
我的代码片段是
use DateTime;
my $now=DateTime->now(
time_zone=> 'America/Los_Angeles');
$now->add( hour=>1 );
我得到的错误是:
The following parameter was passed in the call to DateTime::Duration::new but was not listed in the validation options: day at c:\strawberry....
DateTime::Duration::new(undef, 'day', 1) called at c:\strawberry....
DateTime::add('DateTime=HASH(0x2e49ae0)', 'day', 1) called at tester.pl line 6
我怎样才能让它工作?