Dates selecting for each week

Hello,
I have an issue in selecting dates. There are two boxes from date and to date. But here here’s only possibility of selecting only 7 days (1st -7th). I need to take every week. Like 1st-7th, 8th-14th unless it matches today’s date. Please help me with this issue.

Hi,

How about the following?

Enumerable.Range(0,Today.Day\7-CInt(Today.Day mod 7<>0)).Select(Function(i) Enumerable.Range(1,Today.Day).Skip(i*7).Take(7).First.ToString+"-"+Enumerable.Range(1,Today.Day).Skip(i*7).Take(7).Last.ToString).ToArray

Sample20230822-4L.zip (2.3 KB)

We can also these value separately if necessary.

Regards,

Hello, Thank you for your response.
Do I need to pass the variable two types. As in from date column and to date column.

HI,

The following will work as you expect. Can you try this?

Enumerable.Range(0,Today.Day\7-CInt(Today.Day mod 7<>0)).Select(Function(i) dt.LoadDataRow({Enumerable.Range(1,Today.Day).Skip(i*7).Take(7).First.ToString,Enumerable.Range(1,Today.Day).Skip(i*7).Take(7).Last.ToString},False)).CopyToDataTable()

Sample20230822-4L (2).zip (2.8 KB)

Regards,

Hello, Here I’m getting dates but Unable to select in the from date box in website.
From date- 01/08/2023 To Date- 07/08/2023 Download data
From date-08/08/2023 To Date- 14/08/2023 Download data
From date- 15/08/2023 To Date- 21/08/2023
Here How to pass the variable in both the selectors.

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