in reply to About this week Date
The builtin function localtime gives you all the elements you need.
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); my $monday = $mday - $wday + 1; my $friday = $mday - $wday + 5;
Of course this doesn't work if you aren't in the middle of a month (e.g. if ($mday - $wday + 1) < 0). You could take your time() and add or subtract 24*60*60 seconds per day to get the right unix time, then convert to date with localtime()
|
|---|