Hello,
with for each read date from excel the result is variable string with assing
str1=row.item(“namecolumn”).tostring
Can the result be + 1 day in the same for each other variable type string?
Hello,
with for each read date from excel the result is variable string with assing
str1=row.item(“namecolumn”).tostring
Can the result be + 1 day in the same for each other variable type string?
HI @pl.rusinov
Welcome to UiPath community
This expression will add the date +1 from the current date
str1 = DateTime.Now.Adddays(1).Tostring
Regards
Gokul
If you need to add the date from the input that you have in the excel then you can try with this expression
DateTime.ParseExact(row(“namecolumn”).tostring,"dd/MM/yyyy",System.Globalization.CultureInfo.InvariantCulture).Adddays(1).ToString("dd-MM-yyyy")
You can give the excel format here dd/MM/yyyy
Regards
Gokul
HI @pl.rusinov
You can also try like this
DateTime.ParseExact(str1,{"dd.MM.yyyy","MM/dd/yyyy hh:mm:ss","dd/MM/yyyy hh:mm:ss","dd-MM-yyyy"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).AddDays(+1).ToString("Whatever format you need")
Inside the String of Array of formats of Dates you can pass as many as formats to match with the format that is in the excel file
Regards
Sudharsan
hi
the other variable stops with this error
DateTime.ParseExact(str1,{"dd.MM.yyyy","MM/dd/yyyy hh:mm:ss","dd/MM/yyyy hh:mm:ss","dd-MM-yyyy","dd.M.yyyy"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).AddDays(+1).ToString("Whatever format you need")
Try this
HI @pl.rusinov
Try with this expression
DateTime.ParseExact("10.01.2023","dd.M.yyyy",System.Globalization.CultureInfo.InvariantCulture).Adddays(1).ToString("dd-MM-yyyy")
Regards
Gokul
@pl.rusinov
If these case happened again what you need to do is simply add that date format in the array you used in the expression
What error you had 10.1.2023 was not recognized means it cant find the correct format in the array of you had before
10.1.2023- dd.M.yyyy
So in the latest expression i shared i have added the new format in array i used in the expression
You just need to add the new expression by seperated as comma
{“dd.MM.yyyy”,“MM/dd/yyyy hh:mm:ss”,“dd/MM/yyyy hh:mm:ss”,“dd-MM-yyyy”,“dd.M.yyyy”,“New Format”}
Regards
Sudharsan
Thanks
worked
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.