in reply to How do i get "the last day of last month"?
I don't believe this solution has any time zone problems either... :)my ($mon,$year) = (localtime())[4,5]; $year +=1900; # perl counts months begining at 0 while cal begins at 1 so # the month returned from perl's localtime is already last # month, we just need to fix for jan $mon = 12 if ! $mon; my $last_day_last_month=(split /\s/, `/bin/cal $mon $year`)[-1];
--
Life is a tale told by an idiot -- full of sound and fury, signifying nothing. William Shakespeare, Macbeth
|
|---|