String was not recognized as a valid DateTime - Why this error is coming suddenly?

The “String was not recognized as a valid DateTime” error has unexpectedly emerged.
It has been functioning correctly for the past three months, but now this error has surfaced.
I have verified that the input format remains unchanged from before.

Kindly assist me in resolving this issue.

I have used - Datetime.ParseExact(CurrentRow(“Posting Date”).ToString,“dd-MM-yyyy”,system.Globalization.CultureInfo.InvariantCulture).ToString(“ddMMyyyy”)


If input string is not 01-12-2023 but 1-12-2023, can you try the following expression?

Datetime.ParseExact(CurrentRow("Posting Date").ToString,"d-M-yyyy",system.Globalization.CultureInfo.InvariantCulture).ToString("ddMMyyyy")



can you try this once

Datetime.ParseExact(CurrentRow("Posting Date").ToString,{"dd-MM-yyyy","dd/MM/yyyy","d-M-yyyy","dd-MM-yyyy hh:mm:ss},system.Globalization.CultureInfo.InvariantCulture).ToString("ddMMyyyy")
1 Like


Try first parsing to format:

Then to:



set a breakpoint before the type into
debug and get paused
use the immediate panel and inspect the CurrentRow(“Posting Date”).ToString Value

Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

Also you can directly prototype the possible corrective statements within immediate panel

For analysis statements to find all invalid, out for expected format dates have a look here:
:ambulance: :sos: [FirstAid] Datatable: Debug & Analysis invalid DateTime Strings / String to DateTime Parsing Issues - News / Tutorials - UiPath Community Forum

It gives an Error


Datetime.ParseExact(CurrentRow("Posting Date").ToString,{"dd-MM-yyyy","dd/MM/yyyy","d-M-yyyy","dd-MM-yyyy hh:mm:ss"},system.Globalization.CultureInfo.InvariantCulture).ToString("ddMMyyyy")

sorry my bad can you us this


My Input Is Posting Date

Still Error is Coming

As mentioned in the FirstAid

This is the reason why we check on the data table level

1 Like


please type the expression manually dont copy and paste it

Not solved yet, Still same Error

When working format array, the method signature is to meet


taken from: FirstAid

Try this:

Step 1: capture the current row to a string variable called ‘yourstr’

Left assign:

Right assign:
DateTime.ParseExact(CurrentRow(“Posting Date”).ToString,“dd-MM-yyyy”,system.Globalization.CultureInfo.InvariantCulture).ToString(“ddMMMyyyy”)

Step 2: convert to your desired format

Left assign:

Right assign:

Hopefully this helps



This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.