SQL to return dates that fall in period and range

Posted by Nate on Stack Overflow See other posts from Stack Overflow or by Nate
Published on 2010-03-17T21:37:08Z Indexed on 2010/03/17 21:41 UTC
Read the original article Hit count: 312

Filed under:
|

Hey stackers,

I’ve been grinding my head on this for a while… My goal is to return all dates that fall between a start and end date and have a certain period as a factor, from the start date. (hard to explain)

For example…

Start Date: Nov 20, 1987; End Date: Jan 01, 1988; Period: 10 days;

I want these dates: Nov 20, 1987; Nov 30, 1987; Dec 10, 1987; Dec 20, 1987; Dec 30, 1987;

I already have a date table with all dates from 1900 to 2099. The period could be by days, months or years. Any ideas? Let me know if you need more info.

© Stack Overflow or respective owner

Related posts about sql

Related posts about dates