fixing instantToDateFormatString
This commit is contained in:
parent
f5cc79ec1f
commit
88fcc4d707
1
pom.xml
1
pom.xml
|
@ -97,6 +97,7 @@
|
|||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- LOGGER -->
|
||||
|
|
|
@ -724,23 +724,21 @@ public class ConvertToDataValueObjectModel {
|
|||
if (instantString == null)
|
||||
return null;
|
||||
|
||||
String time = instantString;
|
||||
String time = instantString.trim();
|
||||
DateTimeFormatter formatter = null;
|
||||
try {
|
||||
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT + " " + TIME_FORMAT);
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Parsing error: ", e);
|
||||
}
|
||||
|
||||
try {
|
||||
if (formatter != null) {
|
||||
|
||||
if(time.contains("T")) {
|
||||
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT + " " + TIME_FORMAT);
|
||||
LocalDateTime instant = LocalDateTime.parse(time);
|
||||
|
||||
return formatter.format(instant);
|
||||
}else {
|
||||
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT);
|
||||
LocalDate instant = LocalDate.parse(time, formatter);
|
||||
return formatter.format(instant);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Date format error: ", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return instantString;
|
||||
|
|
Loading…
Reference in New Issue