Don't get me wrong, your code works great, but the dates are not correct. Let me see if I can explain it better. The second calculation needs to begin 1 year back + 1 month and march towards the current month for the # of months equal to # of days/30. For example, assuming the current month is 11/06 and # of days = 120, the beginning month would be 1 year back (11/05) + 1 month so it would be 12/05 and would sum months (12/05 + 01/06 + 02/06 + 03/06).
Here's how the table is setup:
mth_00 = current month (11/2006)
mth_01 = 10/2006
mth_02 = 09/2006
mth_03 = 08/2006
mth_04 = 07/2006
mth_05 = 06/2006
mth_06 = 05/2006
mth_07 = 04/2006
mth_08 = 03/2006
mth_09 = 02/2006
mth_10 = 01/2006
mth_11 = 12/2005
mth_12 = 11/2005
mth_13 = 10/2005
mth_14 = 09/2005
etc...
Here's the date ranges for each of the months (assume # of days = 120)
If current month = 11, month range should be 8,9,10,11
If current month = 10, month range should be 9,10,11,12
If current month = 09, month range should be 10,11,12,13
If current month = 08, month range should be 11,12,13,14
If current month = 07, month range should be 12,13,14,15
If current month = 06, month range should be 13,14,15,16
etc...
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.