In addition to agreeing with the previous posters that there are excellent modules out there that solve this problem better, I have a general comment about your code:
Any time you have that many if-elses or ifs in a row, program your brain to think of either a loop, or a hash, or both. Your month-to-num and the reverse could have been implemented better with an array or hash-reversed solution. Adding to month can then be a switch to a number, then a normal add, then a switch back, etc.
I can't make any sense out of the validate_Month subroutine... (it returns days? why? And the leap year code is mystifying...) but that would be a lot easier with a hash.
Not for this code, which should be replaced with an existing module, but for next time.
In reply to Re: adding/subtracting calender dates
by fishbot_v2
in thread adding/subtracting calender dates
by Fuism
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |