폴리글랏으로 프로그래밍하며, 여러 언어로된 도메인끼리 메세지를 보내다보니 파일 포맷에 대한 이슈가 있었다.
LocalDateTime.now() 를 외부에 전송하게 되면 "2021-11-02T00:05:03.128"
이런식의 String 으로 발송된다.
Javascript 에서 이를 호환된 포맷으로 전송하기 위해서는
moment 를 사용할 경우에는 아래와 같은 포맷으로 작성하면 된다.
moment.tz('Asia/Seoul').format('YYYY-MM-DD[T]HH:mm:ss.SSS')
참고자료
https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#patterns
DateTimeFormatter (Java Platform SE 8 )
Parses the text using this formatter, without resolving the result, intended for advanced use cases. Parsing is implemented as a two-phase operation. First, the text is parsed using the layout defined by the formatter, producing a Map of field to value, a
docs.oracle.com
https://www.javatpoint.com/java-localdatetime
Java LocalDateTime - Javatpoint
Java LocalDateTime example with concepts and examples of Java 8 Time, java.time package, LocalDate, LocalTime, LocalDateTime, Calendar, Clock, MonthDay, OffsetDateTime, OffsetTime, TimeZone, ZonedDateTime, ZoneId etc.
www.javatpoint.com
'Programming Language 이해하기 > Java 이해하기' 카테고리의 다른 글
Java의 비동기(Async) 프로그래밍을 제공하는 JDK를 다시는 무시하지 말자! (1) | 2024.07.28 |
---|---|
#2 스터디 할래 - 2주차 (0) | 2021.11.14 |
#1 스터디 할래 - 1주차 (0) | 2021.10.30 |
객체지향의 재사용성과 다이나믹 디스패치, 더블 디스패치에 관한 이야기 (0) | 2021.03.06 |
replaceFirst()과 정규표현식의 실수 (0) | 2021.02.26 |
댓글