It doesn't find the current week — it finds the week before and after a reference date — and it's more elaborate than necessary.
For Sunday,
my $dt = DateTime->today(); my $dow = $dt->day_of_week(); $dt->substract( days => $dow % 7 );
For Monday,
my $dt = DateTime->today(); my $dow = $dt->day_of_week(); $dt->substract( days => ( $dow + 6 ) % 7 );
In reply to Re^2: Is there an easy way to get the start date of the current week?
by ikegami
in thread Is there an easy way to get the start date of the current week?
by ramjamman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |