Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
So, to sum up, you want to . . .
  1. Have your script find the day of the week today
  2. If it's a Wed or Fri, query your db and find all projects due today+14 days into the future or sooner. Else, end the script
  3. Foreach of those, see if there is another Wed or Fri between now and the due date. If so, send a reminder. If not, send a reminder and a notice to management.

If you haven't already, look at The Many Dates and Times of Perl.

I prefer to work with epoch time when doing calculations, and convert back to other formats for db queries or display.

I would get the epoch time, then find the day of the week with Date::Day. Adding 14*24*60*60 to the current epoch time give you the epoch time two weeks from now (since epoch is in seconds, convert 14 days to hours then minutes then seconds to find that, thus 14*24*60*60). I assume you're using a databse to store projects, so just query for all projects due BETWEEN those two dates, after having converted them into a format the db likes.


In reply to Re: Finding the dates for the reminder mail system by eighty-one
in thread Finding the dates for the reminder mail system by d-evil

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-19 15:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found