Type Into - Yesterday's Date (Decrement day)

Hi all,
I need to type yesterday’s date in a SAP field. I would also like that when it’s monday, the robot considers from previous friday to previous sunday.

I tried adding this form: DateTime.Now.AddDays(-1).ToString(“ddMMyyyyy”)

in here:

Can you please help me?

This is what I’m obtaining:

Thank you very much.
Best regards,
Tiago Dias


Hello Tiago,
please try this …

… to fill the date field.


To handle Saturday and Sunday please try this:

Saturday is minus 2 and default is the same as in the example above.

Happy automating.

Best regards


If we want to use VB.net expression in StudioX, we need to use Advanced Editor. Can you try this?



Hey Please first find today is Monday or not for this you can use datetime.Now.toString(“dd”) and this value in string variable day

and then check in if condition whether day is Monday or not
day == “Mon”

if condition is true then subtract your day with -2

hope you find this solution

Based on Yoichi’s feedback give a try on following statement:

Thank you all.
How do I type the date format with dots, for example 12.08.2021?

These are my system settings:

Will this Now.AddDays({-2,-3,-1,-1,-1,-1,-1}(Now.DayOfWeek)).ToString(“ddMMyyyyy”) solve also the weekend issue?
As mentioned, I would like that on mondays, it types, on the 1st field, the previous friday and on the 2nd field the previous sunday.

For example, if today was monday 09/08/2021, it would need to type this date interval:

If it was 10/08/2021 (Tuesday), it would need to type 09/08/2021 on both fields.

Thank you in advance.

Tiago Dias

Just configure the Format String usednwithin toString

Date with dots “dd.MM.yyyy”

AS by the Titel for SAT,sun,Mon IT will use the friday before. Tue,wed,thu,fri will use the das before

Thank you. It’s working now.

But I still don’t get it when it’s monday and I want to type an interval from previous friday to previous sunday (“yesterday”)?

Thank you,

Make the question more clear Just by Sharing with us some series of
Input Date: xx.xx.xxxx
Expected Output Date: xx.xx.xxxx


Using Dates Example.zip (4.3 KB)
Here is a subset of a UiPath BOT I wrote that shows assigning Dates in different ways and getting the current, past or next Month, it also shows getting the output as numeric , abbeviation and full name, including day of the week with a Case statement to process day of week named activities.