Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping between dates

Status
Not open for further replies.

Zippeh

Programmer
Sep 24, 2002
56
GB
Hi!

I want to be able to loop between two dates. Say the two date are 2006/01/01 and 2006/02/01. What I want is to be able to access each day in the range so I can pass that day, and the day before it into a function. Hmm that doesn't make sense...

My function is defined as follows:

ychwaneguData($startDate, $endDate)

so my function calls with the above range should be:

ychwaneguData("01/01/2006", "02/01/2006");
ychwaneguData("02/01/2006", "03/01/2006");
ychwaneguData("03/01/2006", "04/01/2006");

Assuming a DD/MM/YYYY format.

Hope that makes sense! Thanks in advance.
 
Take a look at the Date::Calc module. It would be what you need to get all of the dates between two fairly easily. It also has some nice functionality to determine if the date is a business day, holiday or many other functions.

- George
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top