in reply to How for the current date return nearest saturday
use DateTime; use strict; use warnings; my $dt = DateTime->now(); # Dow starts with Monday my %delta = (1 => -2, 2 => -3, 3 => 3, 4 => 2, 5 => 1, 6 => 0, 7 => -1 +); my $saturday = $dt->add(days => $delta{$dt->day_of_week}); print $saturday, "\n";
|
|---|