in reply to Re^4: Finding End of Month's date
in thread Finding End of Month's date
for 46 non-whitespace characters, while it even takes an argument (yours only does the current month). So. size-wise, you lose (unless you want to the longest solution....).print UnixDate DateCalc("@ARGV", "+1m -1d"), "%e";
Whether something is intuitive or not is a subjective thing. The output format may not be very intuitive, it's far more flexible (it could easily be changed to, say "The answer to the question is %e". The "%e" directive of UnixDate is exactly the same as the one of strftime.
As for the implicite truncation not being obvious, I fully agree with that as well. It isn't obvious to me either. In fact, I've no idea what truncation you are referring to.
BTW, I'm pretty convinced I'd get all the edge cases correctly when doing a look-up table. How the lookup-table would look like strongly depends on the edges. (Which years, which calendar, which country, etc). Or did you think the well known formula that checks the remainers of division of the year by 4, 100 and 400 got the edge cases right? ;-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Finding End of Month's date
by Aristotle (Chancellor) on Jan 03, 2005 at 18:40 UTC | |
by Anonymous Monk on Jan 04, 2005 at 09:36 UTC | |
by Aristotle (Chancellor) on Jan 04, 2005 at 19:09 UTC | |
by Anonymous Monk on Jan 05, 2005 at 10:48 UTC |