Graeme McGilvray
asked on
Show all dates set between 2 dates
Hi all, I am not sure how to describe this, but I will try my best.
What I would like to do is show all dates set between 2 dates.
EG - Dates between 8/10/2019 & 21/10/2019 (will vary from each itinerary given to clients)
Show:
8/10/2019
9/10/2019
11/10/2019
12/10/2019
13/10/2019
14/10/2019
15/10/2019
16/10/2019
17/10/2019
18/10/2019
19/10/2019
20/10/2019
21/10/2019
Hopefully this as good as an explanation as needs to be :P
I am coding in ASP Classic and I have tried a few things, just do not work and make a mess, so I need some fresh experienced eyes to put me on the right path
What I would like to do is show all dates set between 2 dates.
EG - Dates between 8/10/2019 & 21/10/2019 (will vary from each itinerary given to clients)
Show:
8/10/2019
9/10/2019
11/10/2019
12/10/2019
13/10/2019
14/10/2019
15/10/2019
16/10/2019
17/10/2019
18/10/2019
19/10/2019
20/10/2019
21/10/2019
Hopefully this as good as an explanation as needs to be :P
I am coding in ASP Classic and I have tried a few things, just do not work and make a mess, so I need some fresh experienced eyes to put me on the right path
ASKER
Hi Saqib, no Macros, do not have a working file. looking for an example of code to start me off
Not fully ASP code, but it will get you on the right track:
Imports System.Globalization
Module Module1
Sub Main()
show_dates("8/10/2019", "21/10/2019")
End Sub
Sub show_dates(from_date As String, to_date As String)
Dim from_date_input As Date = Date.ParseExact(from_date, "d/M/yyyy", CultureInfo.InvariantCulture)
Dim to_date_input As Date = Date.ParseExact(to_date, "d/M/yyyy", CultureInfo.InvariantCulture)
Dim temp_date = from_date_input
Dim output As String = ""
Do Until temp_date > to_date_input
output = output + temp_date.ToString("d/M/yyyy") + vbCrLf
temp_date = DateAdd(DateInterval.Day, 1, temp_date)
Loop
MsgBox(output)
End Sub
End Module
In that case take a look at this file. I have setup a few columns to demonstrate the working. You may change the starting and ending dates to see the changes taking place.
Each column has formulas extending way down. If you itinerary is more than that the formulas may be copied further down. You may also choose to delete the extra formulas extending beyond the end date.
Generate-dates.xlsx
Each column has formulas extending way down. If you itinerary is more than that the formulas may be copied further down. You may also choose to delete the extra formulas extending beyond the end date.
Generate-dates.xlsx
ASKER
Hi Saqib, unfortunately an excel spreadsheet isnt going to help me put this in ASP Code (as asked)
Hi Kimputer, will give this a crack and get back to you
Hi Kimputer, will give this a crack and get back to you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi Saqib, unfortunately an excel spreadsheet isnt going to help me put this in ASP Code (as asked)
Ok. The question was posted in Excel Zone so that is what I thought.
ASKER
Ah ok, must of auto selected that, I did not do it...
Please upload a sample file for working.