A good module for finding the difference between two dates in days is Date::Calc. I used it to do something similar to what I think you are attempting to achieve. I wrote a script that checks a list of important days (i.e. - birthdays, anniversaries, etc) and emails me a reminder two weeks in advance. What can I say, I'm a forgetful person at times.
Anyway, the Date::Calc module can be used to find the number of days, as well as a huge assortment of other cool bits of information. I use the line
$difference = Delta_Days ($current_year, $current_month, $current_day, $stored_year, $stored_month, $stored_day); and the Date::Calc module returns the days between. The module takes standard input: yyyy for the year, mm (0-11) for the month, and dd (1-X) for the day. I also use the standard
localtime[3,4,5] to get today's date before sending it to the Date::Calc module.
Read up on the module and you'll discover its many uses. -Eric
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.