|
|
package com.example.demo;
|
|
|
|
|
|
import org.dom4j.DocumentException;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.time.Instant;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneId;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.Date;
|
|
|
|
|
|
public class T_TIME_TEST {
|
|
|
protected static final Logger logger = LoggerFactory.getLogger(T_TIME_TEST.class);
|
|
|
|
|
|
public static void main(String[] args) throws IOException{
|
|
|
String T_timeStr = "2018-11-14T04:02:00";
|
|
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("YYYY-MM-dd'T'HH:mm:ss");
|
|
|
// ZonedDateTime depZoneTime = ZonedDateTime.parse(T_timeStr,dateTimeFormatter.ISO_ZONED_DATE_TIME);
|
|
|
LocalDateTime localDateTime = LocalDateTime.parse(T_timeStr,dateTimeFormatter.ISO_DATE_TIME);
|
|
|
ZoneId zone = ZoneId.systemDefault();
|
|
|
Instant instant = localDateTime.atZone(zone).toInstant();
|
|
|
Date date = Date.from(instant);
|
|
|
logger.debug(date.toString());
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|