method earlier

Documentation for method earlier, assembled from the following types:

class Date

From Date

(Date) method earlier

Defined as:

method earlier(Date:D: *%unit)

Returns a Date object based on the current one, but with a date delta towards the past applied. See method later for usage.

my $d = Date.new('2015-02-27');
say $d.earlier(month => 5).earlier(:2days);  # OUTPUT: «2014-09-25␤» 

class DateTime

From DateTime

(DateTime) method earlier

Defined as:

method earlier(DateTime:D: *%unit)

Returns a DateTime object based on the current one, but with a time delta towards the past applied. See method later for usage.

my $d = DateTime.new(date => Date.new('2015-02-27'));
say $d.earlier(month => 1).earlier(:2days);  # OUTPUT: «2015-01-25T00:00:00Z␤»