Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 690245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:24:58+00:00 2026-05-14T02:24:58+00:00

I’ve been grinding my head on this for a while… My goal is to

  • 0

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.

MySQL

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T02:24:58+00:00Added an answer on May 14, 2026 at 2:24 am

    For days use DATEDIFF and the modulo operation:

    SELECT * FROM dates
    WHERE `date` BETWEEN '1987-10-20' AND '1988-1-1'
    AND DATEDIFF(`date`, '1987-10-20') % 10 = 0
    

    For a period of 10 years, calculate the difference in the year modulo the period, and ensure that the month and day are the same:

    SELECT * FROM dates
    WHERE `date` BETWEEN '1980-10-20' AND '2000-10-20'
    AND MONTH(date) = 10 AND DAY(date) = 20 AND (YEAR(date) - 1980) % 10 = 0
    

    A period measured in months is not well-defined because months have different lengths. What is one month later than January 30th? You can get it working for some special cases such as ‘first in the month’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Been a while since I've dealt with ASP.NET and this is the first time
This has been grinding my gears for at least a week now. I have
Been looking at this for a while and even posted another question and got
Been using PHP/MySQL for a little while now, and I'm wondering if there are
Been running into this problem lately... When debugging an app in VS.Net 2005, breakpoints
Having been a PHP developer on LAMP servers for quite a while, is there
been looking at this for days.. - (void)viewDidAppear:(BOOL)animated { #if !TARGET_IPHONE_SIMULATOR UIButton *returnButton =
Been working on this for hours now so any insight would be greatly appreciated.
Been trying to get an answer on what I am doing wrong all over
Been stuck on this for days, things just aren't working with how I'm setting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.