Extarction of Date based on the Current Date

Hello Team

How can we fetch starting date and ending date based on current date

Have explained with Example

Example 1 and 2 are similar case.
But if at time we have scenario 3) Then the format for extraction of the date will get changed as explained

Example 1): If today is 20th Nov

Then fetch starting date as :6|11|2023(Monday)

Ending Date : 12|11|2023(Sunday)

Example 2): If today is 27th Nov

Then fetch starting date as :13|11|2023(Monday)

Ending Date : 19|11|2023(Sunday)

3)But if Today’s date is 13th Nov

Then fetch starting date as :1|11|2023(Cannot take monday in this case because its then October in this case.Therefore first day of Month)
Ending Date : 5|11|2023

Thanks in advance

In general we do understand

from a given date:

  • optional go back to the Moday of the same week - initDate
  • go back 2 weeks / -14 days, But stop when goining back results to fall down into the previous month -dateStart
  • calculate the same week Sunday on the base of dateStart - dateEnd

But lets assume initDate = Monday 6th Nov 2023
what behaviour would you expect, as going back 14 days will fall into October?

Just a few starter help samples:

Also have a look at the Modify Date Activity

Hello @ppr

If its 6th Nov

Then it will be having

  1. Starting Date = 30th
    Ending Date 31st


  1. Starting Date = 1st Nov
    Ending Date = 5th Nov

Basically Both of these

we have some doubts on the go back rules consistency - but at least

will work with the same code lines from above

Hello @ppr

Thanks for the quick response

Could you also help me with understanding the Logic we have used


We are creating with Enumerable.Range a series of numbers

And are using to go back (AddDays(-1,-2,…) till the end of the series or we reached the previous month

[HowTo] LINQ (VB.Net) Learning Catalogue - Help / Something Else - UiPath Community Forum


we configured an Array with a predefined offsets and selecting the offset depending to DayOfWeek

For RnD & Prototyping / Explorations you can use the debugging panel e.g. immediate Panel
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

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