Week range based on date

HI I would like to find week range for the date given ex for
27.10 2023 it should give week range as 23 oct 2023 to 27 oct 2023

Hi @Mopur_Kishore1

- Assign: dateInput = "27.10.2023"
- Assign: str_date = DateTime.ParseExact(dateInput, "dd.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture)
- Assign: str_dayOfWeek = Convert.ToInt32(str_date.DayOfWeek)
- Assign: weekStart = str_date.AddDays(-str_dayOfWeek)
- Assign: weekEnd = weekStart.AddDays(6)
- Assign: weekRange = weekStart.ToString("dd MMM yyyy") & " to " & weekEnd.ToString("dd MMM yyyy")
- Message Box: weekRange

Note: str_date, weekStart, weekEnd is of DataType System.DateTime. str_dayOfWeek is of DataType System.Int32

Hope it helps!!

1 Like

Hi @Mopur_Kishore1

Check out the workflow for better understanding:
Sequence1.xaml (9.4 KB)

Hope it helps!!
Regards,

1 Like

Thanks much for your quick help

1 Like

Hi @Mopur_Kishore1

Welcome to Community!!

You can simply try this

InputDate=DateTime.ParseExact("27.10.2023", "dd.MM.yyyy",System.Globalization.CultureInfo.CurrentCulture)
FinalDate=InputDate.AddDays(-CInt(InputDate.DayOfWeek)).ToString("dd MMM yyyy") & " to " & InputDate.AddDays(6 - CInt(InputDate.DayOfWeek)).ToString("dd MMM yyyy")

Hope this helps!!

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