I am trying to convert date yyyy-MM-dd HH:mm:ss to format MM/dd/yyy using datetime.parseexact(“2021-10-31 01:17:09”,“yyyy-MM-dd HH:mm:ss”, System.Globalization.Cultureinfo.InvariantCulture).Tostring(“MM/dd/yyyy”)
But getting error message string was not recognised as a valid date time.
How can I rectify this error. Please help
Welcome to our UiPath community.
Please try below expression.
Your expression seems no problem as the following.
Can you try the following sample?
Sequence1.xaml (4.5 KB)
Welcome to uipath forum
You are almost done
If the input variable of string named strinput is of this format
Then use a assign activity like this
stroutput = DateTime.ParseExact(strinput.ToString.SubString(0,10).ToString.Trim, “yyyy-MM-dd”, System.Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”)
It works now. Though not sure what was the mistake I did. Thanks
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.