I am looping through a range of consecutive dates. I need to find out which are weekends so they can be discarded. One method would be to determine the day of week via perl (what my script is written in) or query with each pass through the loop. There will never be more than 30 dates, usually 5 or less to check. Would it be more efficient to load up Date::Time and use perl or run a Query without needing modules? If perl is the best method I could use a little help extracting the day of week from the YYYY-MM-DD format. I’d be ok with number 1-7 or shortname mon-sun.
2012-05-01
2012-05-02
2012-05-03
2012-05-04
2012-05-05
2012-05-06
not sure if this is possible but perhaps a more suitable solution would be to write a query (since I know the start and end and they are consecutive) to count days between x and y where dayofweek NOT IN(6,7)
1 Answer