You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Review의 경우 후기 작성 날짜와 시간이 모두 필요하여 기존 Date 타입이었던 변수 dateTime을 LocalDateTime으로 변경
현재 날짜가 기록되어야하는 경우, LocalDate로 변경 가능
현재 시간이 기록되어야하는 경우, LocalTime으로 변경 가능
Controller에서는 LocalDateTime dateTime = LocalDateTime.now();와 같은 형식으로 현재 날짜 및 시간 할당 가능
+) 자동적으로 입력되는(현재 날짜/시간) 값의 경우 DTO로 받아올 필요가 없기 때문에 DTO에서 해당 변수 삭제하시면 됩니다.
The text was updated successfully, but these errors were encountered:
개선 전 상황
현재 날짜 및 시간을 자동으로 파악하여 저장하는 기능 관련하여
기존에 사용했던 java.util.Date에 비해 java.time.LocalDate / java.time.LocalDateTime 사용이 보다 편리하다고 느꼈습니다.
(java8 이후로 java.util.Date를 잘 쓰지 않는다는 이야기도 있었습니다.)
개선 내용
LocalDateTime
으로 변경LocalDate
로 변경 가능LocalTime
으로 변경 가능LocalDateTime dateTime = LocalDateTime.now();
와 같은 형식으로 현재 날짜 및 시간 할당 가능+) 자동적으로 입력되는(현재 날짜/시간) 값의 경우 DTO로 받아올 필요가 없기 때문에 DTO에서 해당 변수 삭제하시면 됩니다.
The text was updated successfully, but these errors were encountered: