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 6385559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:54:55+00:00 2026-05-25T02:54:55+00:00

For example: from datetime import date d1 = date(2008,8,15) d2 = date(2008,9,15) I’m looking

  • 0

For example:

from datetime import date

d1 = date(2008,8,15)
d2 = date(2008,9,15)

I’m looking for simple code to print all dates in-between:

2008,8,15  
2008,8,16  
2008,8,17  
...  
2008,9,14  
2008,9,15

Thanks

  • 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-25T02:54:55+00:00Added an answer on May 25, 2026 at 2:54 am

    I came up with this:

    from datetime import date, timedelta
    
    start_date = date(2008, 8, 15) 
    end_date = date(2008, 9, 15)    # perhaps date.now()
    
    delta = end_date - start_date   # returns timedelta
    
    for i in range(delta.days + 1):
        day = start_date + timedelta(days=i)
        print(day)
    

    The output:

    2008-08-15
    2008-08-16
    ...
    2008-09-13
    2008-09-14
    2008-09-15
    

    Your question asks for dates in-between but I believe you meant including the start and end points, so they are included. To remove the end date, delete the "+ 1" at the end of the range function. To remove the start date, insert a 1 argument to the beginning of the range function.

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

Sidebar

Related Questions

For example: from datetime import <c-x><c-o>{list of modules inside datetime package}
I start out with date strings: from operator import itemgetter import datetime as DT
I am using the example from TheElements sample code provided with the iPhone SDK
With regards this example from Code Complete: Comparison Compare(int value1, int value2) { if
I want to subtract from a DateTime . Example: date1 = 13/01/2004 12:20:00 result
I made this code into an executable with py2exe: # File: zipfile-example-1.py from Tkinter
I've set up this simple script on my local machine: #!/usr/bin/python import socket from
For example, how to create an instance of Datetime from string '03/10/2010 12:00:00 AM'?
i'm trying to use the class DateTime (php>=5.3) to calculate difference from 2 date.
import os import urllib import workerpool from datetime import datetime class DownloadJob(workerpool.Job): def __init__(self,

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.