in reply to Determining the dayname for the last day of any given month
The trick is that the last day of the month is the day before the first day of next month. So here's an example solution with Date::Manip:
This prints Friday.use Date::Manip; $input = "June 2006"; # these also work: #$input = "2006 june"; #$input = "today"; #$input = "June 2006"; $thismonth = UnixDate($input, "%B %Y"); $lastofmonth = DateCalc($thismonth, "+1 month -1 day"); $dow_lastofmonth = UnixDate($lastofmonth, "%A\n"); print $dow_lastofmonth;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Determining the dayname for the last day of any given month
by davorg (Chancellor) on Jun 19, 2006 at 14:04 UTC | |
by ambrus (Abbot) on Jun 19, 2006 at 14:25 UTC |