Set single element:
$dt->set( year => 2016 );
Set many elements:
$dt->set( year => 2016, 'month' => 8);
Add duration to datetime
$dt->add( hour => 1, month => 2)
Datetime subtraction:
my $dt1 = DateTime->new(
year => 2016,
month => 8,
day => 20,
);
my $dt2 = DateTime->new(
year => 2016,
month => 8,
day => 24,
);
my $duration = $dt2->subtract_datetime($dt1);
print $duration->days
You will get the result is 4 days