Last active
October 25, 2019 08:41
-
-
Save ghostflare76/f458554ac99cc728acafce621eb6f96d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void offsetTimeString_TO_LocalDateTime() { | |
// 표준ISO8601 타입으로 넘어오지 않는 경우 대응을 위해 구현 | |
// ex)T 생략 , zoneOffSet 공백으로 구분되어 넘어옴 | |
String offsetTimeString="2019-10-25 15:44:52.775 +09:00".replaceFirst(" ", "T").replace(" ", ""); | |
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"); | |
LocalDateTime localDateTime = OffsetDateTime.parse(offsetTimeString).toLocalDateTime(); | |
System.out.println(localDateTime.format(formatter)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment