Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a good way to determine dates in a date range?

What is a good Perl module (or good approach) that returns all the valid calendar dates between a start date and an end date?

For example, if I have 1/29/2009 as a start date and 2/3/2009 as an end date then I would like it to return an array of 1/30/2009, 1/31/2009, 2/1/2009, and 2/2/2009. There must be a good Perl module that already does this and accounts for leap years, months, but I can't find it.

Thanks for your suggestions!

like image 514
NoahD Avatar asked Nov 29 '22 12:11

NoahD


1 Answers

DateTime, I've used it many times and it can do pretty much anything you can think of with dates. It handles leap years, leap seconds, invalid dates/times, it can output dates in any format, it can compare, add, subtract, etc...

The only issue is that it might be overkill.

like image 73
Ben S Avatar answered Dec 05 '22 10:12

Ben S