I need help with converting a string 125202471300 into a DateTime format in UiPath. The desired output format is MM/dd/yyyy HH:mm:ss.
The string is in the format MMddyyyyHHmmss, where:
MM is the month (2 digits),
dd is the day (2 digits),
yyyy is the year (4 digits),
HH is the hour (2 digits),
mm is the minute (2 digits),
ss is the second (2 digits).
However, when I try to parse the string, the date and time are not showing the leading zeros correctly (e.g., for the day “05” instead of “5”). Can you help me ensure the correct formatting with leading zeros?
The following errors were encountered while processing the workflow tree:
‘VisualBasicValue’: Compiler error(s) encountered processing expression “DateTime.Parse(strExtractedDate, “MMddyyyyHHmmss”, System.Globalization.CultureInfo.InvariantCulture)”.(2) : error BC30512: Option Strict On disallows implicit conversions from ‘String’ to ‘IFormatProvider’.
(2) : error BC30311: Value of type ‘CultureInfo’ cannot be converted to ‘DateTimeStyles’.
I am seeing this issue
format recognition is working from left to right and will fail on ambigious formatted date strings
in such case we can stabilize the flow with Regex and format detection and will handle (e.g. sorting out / flowing back for resolution) for the not recognized formats