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>
|
<groupId>javax.xml.bind</groupId>
|
||||||
<artifactId>jaxb-api</artifactId>
|
<artifactId>jaxb-api</artifactId>
|
||||||
<version>2.3.0</version>
|
<version>2.3.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- LOGGER -->
|
<!-- LOGGER -->
|
||||||
|
|
|
@ -724,23 +724,21 @@ public class ConvertToDataValueObjectModel {
|
||||||
if (instantString == null)
|
if (instantString == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
String time = instantString;
|
String time = instantString.trim();
|
||||||
DateTimeFormatter formatter = null;
|
DateTimeFormatter formatter = null;
|
||||||
try {
|
try {
|
||||||
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT + " " + TIME_FORMAT);
|
|
||||||
} catch (Exception e) {
|
if(time.contains("T")) {
|
||||||
LOG.warn("Parsing error: ", e);
|
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT + " " + TIME_FORMAT);
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (formatter != null) {
|
|
||||||
LocalDateTime instant = LocalDateTime.parse(time);
|
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);
|
return formatter.format(instant);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.warn("Date format error: ", e);
|
LOG.warn("Date format error: ", e);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return instantString;
|
return instantString;
|
||||||
|
|
Loading…
Reference in New Issue