|Just another Perl shrine|
perl script to calculate beg and end of current monthby Anonymous Monk
|on May 01, 2006 at 17:47 UTC||Need Help??|
Anonymous Monk has asked for the
wisdom of the Perl Monks concerning the following question:
I am wondering if anyone has a script that can do the following: (in a Unix environment)
> Check what month and year it is currently (For eg. Current Month = May) > Retrieve Last month's beginning and end dates (eg. 04/01/06 and 04/31/06)
I want these values to be passed into another file that will consist of only these values. Eg. I will have a properties file such as... Beg Date 04/01/06
End Date 04/31/06
The reason I need to do this is I have a customized program that queries the database for entries within a certain time period. Since we want to automate this program, we will not be feeding the dates manually each month...therefore, we are going to setup a cron job to automatically run this program with appropriate dates to be queried into the database.
If anyone has other ideas on how to approach this, please advise.
Thank you for your time.