How to add specific date + 10 days?


#1

Hey,

I have a specific date like 02.08.18 and I wanna add 10 days on it to be 12.08.18

How to include cases if month or year will end by adding the 10 days?
For example:
29.08.18 plus 10 days should be 08.09.18

Thanks


#2

If your date is variable type of DateTime, then you can just add it as date.AddDays(10).

Thanks,
Rammohan B.


#3

To convert your date string to a date time type, you will need to use DateTime.ParseExact() probably.

Look here for some examples:
https://forum.uipath.com/search?q=parseexact

Then just add the .AddDays(number)
The same method can be used to subtract days by making it negative.


#4

Hey @ClaytonM
I am getting this error when trying to use DateTime.ParseExact()

what should I do?


#5

Hey @Rammohan91

How to make the date variable type as DateTime? Thanks


#6

Hey Mate,

I believe you are using a variable named CultureInfo. Check the scope of this variable. My guess is, it not accessible at point where you are trying to us it.


#7

Hey, no I am not using a variable named CultureInfo. I thought maybe it’s a default system variable. Should I declare it?


#8

Hi @UiMe

You need to either import the Namespace or use the full namespace infront of the CultureInfo. I think it is System.Globalization.CultureInfo


#9

Oh, my bad. Let me try to create the same scenario.