How to fix date interpretation errors (modern)?

Hi,

I created a custom document on DocumentUnderstanding (Modern). The date is always in the same German format, and it always extracts the correct value. Format: dd.MM.yyyy

Last month, the extracted value as a string representation was this: 05/25/2025, so it’s in this format: MM/dd/yyyy, which is no problem at all for me.

I could just parse it exactly like so: Date.ParseExact(mydate, "MM/dd/yyyy") and later in my robot i can then put the date in into an input field for example like this: mydate.toString("dd.MM.yyyy").

The problem is that this month, the date comes back like this: 04/06/2025, which with my formula is suddenly the 6th of April and not how it should be: the 4th of June.

So why is DocumentUnderstanding extracting the correct text every time but interpreting the date differently? How can I fix this?

TL;DR

  • Last month Document Understanding interpreted date as: MM/dd/yyyy
  • This month dd/MM/yyyy

Why and how to fix?

What machine is this running on? VM, local etc?

Could be localisation, ie different format per machine maybe?

Hi @ShadowDom

DU auto-parses the date using system culture, which may misinterpret formats like 04.06.2025

you can try to use the raw extracted text and parse it manually:

Date.ParseExact(rawText, “dd.MM.yyyy”, CultureInfo.InvariantCulture)

Happy Automation

It is running in the cloud. UiPath Extracts the date and gives it my DocumentUnderstanding Robot.
This robot adds a queue entry with that variable:
DataTableExtracted(0).Rows(0).Item("vorfallsDatum").ToString

DataTableExtracted is this: in_ExtractionResults.DocumentMetadata.ResultsAsDataTables

It’s the default Document Understanding Studio Template for Modern DU.

Anybody has an idea? Today it extracted 6 dates as 05/06/2025 and 6 dates as 06/05/2025

Why is this happening and how to fix? Is it related to document understanding?

This is how I extract the date now, but it didnt fix anything:

DataTableExtracted(0).Rows(0).Item("vorfallsDatum") comes from document understanding modern and comes in the format of MM/dd/yyyy HH:mm:ss.

vorfallsDatum = Date.ParseExact(DataTableExtracted(0).Rows(0).Item("vorfallsDatum").ToString, "MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture).ToString("MM/dd/yyyy")

And here is how i receive the date then and put it back into a date:

vorfallsDatum = If(Date.TryParseExact(vorfallsDatum, "MM/dd/yyyy", CultureInfo.InvariantCulture, Nothing, Nothing), Date.ParseExact(vorfallsDatum, "MM/dd/yyyy", CultureInfo.InvariantCulture), Today)

@ShadowDom Try this,

rawDate = DataTableExtracted(0).Rows(0).Item(“vorfallsDatum”).ToString
If Date.TryParseExact(rawDate, “MM/dd/yyyy HH:mm:ss”, CultureInfo.InvariantCulture, DateTimeStyles.None, parsedDate) _
OrElse Date.TryParseExact(rawDate, “dd/MM/yyyy HH:mm:ss”, CultureInfo.InvariantCulture, DateTimeStyles.None, parsedDate) Then
vorfallsDatum = parsedDate.ToString(“MM/dd/yyyy”)
Else
vorfallsDatum = Today.ToString(“MM/dd/yyyy”)
End If

This line in my Document Understanding bot (that receives the date from document understanding cloud) has fixed it:

(CType(DataTableExtracted(0).Rows(0).Item("vorfallsDatum"), ExtractedField(Of Nullable(Of DateTime)))).Value

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