I have date format like MM/dd/yyyy , this I need to convert that into MM/dd/yy.
how to do this in a standard way. We can do it in .tostring way
now.tostring(“MM/dd/yy”)
hi @RPA_Geek1,
Use parsing + formatting instead of Now.ToString.
DateTime.ParseExact(inputDate, "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("MM/dd/yy")
This converts your input string safely and outputs the required format.
(Use TryParseExact if you want to avoid exceptions.)
You can use the following expression in the Assign activity:
formattedDate = DateTime.ParseExact(dateString.ToString,"MM/dd/yyyy", Globalization.CultureInfo.InvariantCulture).ToString("MM/dd/yy")
Here, dateString is your variable with the format MM/dd/yyyy.