poj#!perl use strict; use Time::Piece; use Time::Seconds; # Thursday I want the date of the following day. # Friday I want the date of this day. # anything else I want the date of the preceeding Friday. # sun mon tue wed thu fri sat my @offset = (-2,-3,-4,-5,1,0,-1); my $td = Time::Piece->localtime; for (0..30){ my $fri = $td + ONE_DAY * $offset[$td->day_of_week]; printf "%s %s\n", $td->strftime("%d/%m/%y"), $fri->strftime("%d/%m/%y"); $td += ONE_DAY; }
In reply to Re: date arithmetic
by poj
in thread date arithmetic
by morgon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |