Page 1 of 1

Umgang mit mehreren Formaten in DateTimeFormatter

Posted: 31 Aug 2025, 12:38
by Anonymous
I am developing using Java 8 a function that must handle the conversion from String to LocalDateTime of the following dates:


[*]2019-06-20 12:18:07.207 +0000 UTC
[*]2019-06-20 12:18:07.20 +0000 UTC < /li>
2019-06-20 12: 18: 07.2 +0000 UTC < /li>
2019-06-20 12:18:07 +0000 UTC < /li>
< /ul>

Die Schläge werden aus einer externen Bibliothek erstellt. /> Befolgen Sie die Vorschläge, die in den optionalen Teilen von SO Antwort in SimpleDateFormat angegeben sind. Ich habe die folgenden Muster ausprobiert: < /p>

Code: Select all

yyyy-MM-dd HH:mm:ss[.S[S[S]]] Z z
yyyy-MM-dd HH:mm:ss[.S] Z z< /code> < /li>
< /ul>

funktioniert jedoch keiner von beiden.>