Different between two dates and separate them based on the weekday name

Hi all, i have struck up with a problem which is, I have two dates as start date(01/January/2023) and end date(21/January/2023) and i have to find all the Saturdays between those two days. Please help me guys. Thanks in advance . :hugs:


First you need to find the difference between two dates :

int_range = DateDiff(DateInterval.Day,date1,date2)

create list:

list_day = new List(of string)

then use for each with typeArgument integer


inside for each use IF to filter day and store the day to list:
DateTime.ParseExact(now.ToString(item.ToString+“/MMMM/yyyy”),“d/MMMM/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dddd”).ToLower = “saturday”

hope this will help you


Hope the following sample helps you.



arrSaturday = Enumerable.Range(0,(d2-d1).Days+1).Select(Function(i) d1.AddDays(i)).Where(Function(d) d.dayOfWeek=DayOfWeek.Saturday).ToArray()

note: arrSaturday is DateTime array type.

We can easily output it to “dd/MMMM/yyyy” style like d.ToString(“dd/MMMM/yyyy”)

String.Join(vbcrlf,arrSaturday.Select(Function(d) d.ToString("dd/MMMM/yyyy")))

Sequence.xaml (7.1 KB)


Iam getting error putera i have attached the details of the error below have a look at that.

Hi Mrupendra,

Can u look into this thread

Firoz Rangrez

Hi Yoichi ji, i want to write all Saturday dates in different Excel sheet like 7/01/2023 is Saturday from 7/01/2023 to 01/01/2023 in sheet1 and other Saturday dates in another sheet. Will yopu help me please


Can you elaborate?
The following write date into Sheet1, Sheet2 …, for example.

Sequence.xaml (8.6 KB)

In the above example i have 3 Saturdays one is 7/01/2023, 14/01/2023 and 21/01/2023. Now from 7/01/2023 ,6/01, 5/01, …1/01/2023 like same for all the saturday dates should be writen in different excel sheet

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.