Adding and Subtracting Dates

Author: stmuk

You want to calculate a past or future timeday from a given one.

Source code: 03-04-date-add-sub.p6

#!/usr/bin/env perl6

use v6;

# the past using whole days

my $wall = Date.new("1981-06-17");
say ($wall-28);

# the future with datetimes

my $dt = DateTime.new("1981-06-17T20:00:00Z");
say $dt.later(:week(2));