Skip to content

Commit a57f352

Browse files
committed
[KNOWAGE-9373] Improve date parsing in DataSetUtilities to handle multiple formats
(cherry picked from commit 9d84554)
1 parent eb015bb commit a57f352

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

knowageutils/src/main/java/it/eng/spagobi/tools/dataset/utils/DataSetUtilities.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,14 @@ public static Object getValue(String value, Class type) {
460460
java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
461461
result = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
462462
} catch (DateTimeParseException exc) {
463-
throw new SpagoBIRuntimeException(exc);
463+
// Caused by: it.eng.spagobi.utilities.exceptions.SpagoBIRuntimeException: java.time.format.DateTimeParseException: Text '1998-08-12 00:00:00.0' could not be parsed, unparsed text found at index 19
464+
try {
465+
LocalDateTime localDateTime = LocalDateTime.parse(value,
466+
java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.S"));
467+
result = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
468+
} catch (DateTimeParseException excp) {
469+
throw new SpagoBIRuntimeException(excp);
470+
}
464471
}
465472
}
466473
}

0 commit comments

Comments
 (0)