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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:58:43+00:00 2026-06-01T13:58:43+00:00

I need to get the list of dates between two dates – for e.g.

  • 0

I need to get the list of dates between two dates – for e.g. I have start date 03302012 and enddate 05302012 and I need the output like

03302012
03312012
04012012
04022012
...
05282012
05292012
05302012
  • Feel free to use your date format – I will make transformation by myself.
    Thank you very much!
  • 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-06-01T13:58:44+00:00Added an answer on June 1, 2026 at 1:58 pm

    You could do this by using a recursive template. It’s not the greatest solution since this is subject to stack overflow or out of memory errors (if the date interval you give it is large enough), but it can be a place to start.

    First thing you need for the example below is a way to check a generated value and make sure it’s a valid date (you can find some examples online for that; I just used a sample from an open source project and imported the file in the example just to keep it shorter).

    Then, the idea is to generate the dates by adding a day to the previous one, and then a day to the current one on so on. If the day overflows, you add one to the month and start again from day 1. If month overflows you do the same with the year and start from month 1. Theoretically the only one that never overflows is the year (but you will limit that with the end value of the interval).

    You generate a date and you validate it. If it’s valid and haven’t reached the end of the interval you try to generate another by adding days to it (that’s what happens in block X).

    When you get an invalid value, then something overflowed. It can only be the day or the month (as I mentioned above). I first check for the month (block Y). If that’s the case I start from day 1 of month 1 but for the next year. If it’s the day that overflowed (block Z), then I start from day 1 of the next month.

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
      <xsl:import href="http://www.getsymphony.com/download/xslt-utilities/source-code/54294/"/>
      <xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" />
    
      <xsl:variable name="startDate" select="'03302012'" />  <!-- MMddyyyy format -->
      <xsl:variable name="endDate" select="'05302012'" /> <!-- MMddyyyy format -->
    
      <xsl:template match="/">
        <values>
          <xsl:call-template name="GenerateList">
            <xsl:with-param name="day" select="number(substring($startDate, 3, 2))" />
            <xsl:with-param name="month" select="number(substring($startDate, 1, 2))" />
            <xsl:with-param name="year" select="number(substring($startDate, 5))" />
          </xsl:call-template>
        </values>
      </xsl:template>
    
      <xsl:template name="GenerateList">
        <xsl:param name="day" select="1" />
        <xsl:param name="month" select="1" />
        <xsl:param name="year" select="1" />
    
        <!-- 1 = valid, 0 = invalid according to the imported file -->
        <xsl:variable name="validationResult">
          <xsl:call-template name="date-is-valid">
            <xsl:with-param name="day" select="$day"/>
            <xsl:with-param name="month" select="$month"/>
            <xsl:with-param name="year" select="$year"/>
          </xsl:call-template>
        </xsl:variable>
    
        <xsl:choose>
          <xsl:when test="$validationResult = 0">
    
            <xsl:choose>
              <xsl:when test="$month &gt; 12">
                <!-- block Y -->
                <xsl:call-template name="GenerateList">
                  <xsl:with-param name="day" select="1" />
                  <xsl:with-param name="month" select="1" />
                  <xsl:with-param name="year" select="$year + 1" />
                </xsl:call-template>
              </xsl:when>
              <xsl:otherwise>
                <!-- block Z --> 
                <xsl:call-template name="GenerateList">
                  <xsl:with-param name="day" select="1" />
                  <xsl:with-param name="month" select="$month + 1" />
                  <xsl:with-param name="year" select="$year" />
                </xsl:call-template>
              </xsl:otherwise>
            </xsl:choose>
    
          </xsl:when>
          <xsl:otherwise>
            <!-- block X -->
            <!-- same MMddyyyy format as the interval values -->
            <xsl:variable name="currentDate" select="concat(format-number($month, '00'), format-number($day, '00'), $year)" />
            <value>
              <xsl:value-of select="$currentDate" />
            </value>
            <xsl:if test="not($currentDate = $endDate)">
              <xsl:call-template name="GenerateList">
                <xsl:with-param name="day" select="$day + 1" />
                <xsl:with-param name="month" select="$month" />
                <xsl:with-param name="year" select="$year" />
              </xsl:call-template>
            </xsl:if>
    
          </xsl:otherwise>
        </xsl:choose>
    
      </xsl:template>
    </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to get the changed files list between two dates in SVN. I
I need to get a given week's dates list when a one date of
Possible Duplicate: Get a list of dates between two dates using a function I
i need to get a difference of two dates ,one date from a table
i have a problem with sql query. I need to get list of users.
I have a little doubt. I need to get a list of the files
I want list of dates lies between two dates by select query. For example:
I need to get a list of all Saturday dates in a given year.
I have a list of dates: 1/1/2011 2/2/2011 3/3/2011 4/4/2011 5/5/2011 and i need
I have two List which I am accessing by index (e.g. Name[10] , Date[10]

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.