Hello, i have a date stored in a string variable(got the date using get text) and now i want to add 14days to the date. I feel like first i need to change the string type to date type and then add 14 days. Im having problems figuring out how to do that
Hi @mskym111
Try this:
Output= DateTime.ParseExact(strvar.ToString,"MM/dd/yyyy",System.Globalization.CultureInfo.InvariantCulture).AddDays(14)
Output is of DataType System.DateTime.
Please specify input date format and if you have specific output date format.
Regards
Hello,
can you share a string example to see the format ? if format is OK you can use
Convert.ToDateTime(yourstring).AddDays(14)
Hope this helps !
Str_Out=DateTime.ParseExact(yourDateStringVariable, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture).AddDays(14).ToString("yyyy-MM-dd")
hello, im not sure in what activity or what place should I write this. Thank you for the help
Hi @mskym111
Use this in Assign activity. If possible provide the format of Get Text output. I will help you with steps.
Regards
this is the format of the date 2022.03.17
Hi @mskym111
Try this:
Input = "2022.03.17"
Output= DateTime.ParseExact(Input.ToString,"yyyy.MM.dd",System.Globalization.CultureInfo.InvariantCulture).AddDays(14)
Please specify if you have specific date format for Output @mskym111
Regards
Hi @mskym111
Check the below workflow:
Input = "2022.03.17"
Output= DateTime.ParseExact(Input.ToString,"yyyy.MM.dd",System.Globalization.CultureInfo.InvariantCulture).AddDays(14)
Here Input variable refers to output of GetText Variable. And Output is of DataType System.DateTime.
Another case:
Input = "2022.03.17"
Output= DateTime.ParseExact(Input.ToString,"yyyy.MM.dd",System.Globalization.CultureInfo.InvariantCulture).AddDays(14).ToString("yyyy.MM.dd")
Here Input variable refers to output of GetText Variable. And Output is of DataType System.String.
Regards
Hi @mskym111
there new activity provided by UiPath for doing this
use 1. Extract Date and Time from text activity and
2. Add or subtract from date
Hi @mskym111
This is also an way
Input variable here refers to your Get Text Output variable.
Output is of DataType System.String.
Regards
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.


