Extract Dates for Last Week and the Second Last Week

Hello Team,

We are Extracting For Last Week and Last to Last week dates
From Monday to Sunday

Example 1

If Today’s Date was 12-02-2024

1. Last week date that we need to extract

DayMonday : 05-02-2024
DaySunday : 11-02-2024

Second Last week we need to extract in below format (Contains both Last Month and This Month)

So we perform it Twice for Monday to Sunday because it contains Last Month and this Month

To Split Date

Second Last week date to extract

Last Month
DayMondaylastmonth : 29-01-2024 (Start from Monday)
DaySundaylastmonth : 31-01-2024 (Last day Of Month)

This Month

DayMondaySecond : 01-02-2024 (Start Of Month)
DaySundaySecond : 04-02-2024 (Till Sunday)

The Split Condition We need to add if we have two different Month (Monday and Sunday)

Example 2
If today was 19th Feb then split need not be applied

1. Date Extraction Last Week
DateOfLastWeekFirst : 12-02-2024 (Monday)
DateOfLastWeekSecond : 18-02-2024 (Sunday)

2.Date Extraction Second Last Week
DateOfLastWeekSecondLastWeekFirst :05-02-2024 (Monday)
DateOfLastWeekSecondLastWeekEnd : 11-02-2024 (Sunday)

Thanks team in advance


Can you try the following sample? This outputs required datetimes. Please modify these to your suitable format.

Sample20240219-1.zip (4.7 KB)