--use POSIX 'strftime'; # get today my $today = time; # get current day of week my $dow = (localtime($today))[6]; # get last Sunday (day 0) my $sunday = $today - (86_400 * $dow); # get Tuesday (day 2) my $tuesday = $sunday + (86_400 * 2); # print Tuesday in a nice format print strftime "Tuesday is %d %B %Y\n", localtime $tuesday;
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: how to find out the date 'Tuesday' for this week
by davorg
in thread how to find out the date 'Tuesday' for this week
by glitch
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |