꿀팁 활용
자바 DateTimeFormatt 데이트 포맷 만들어 놓고 쓰기
jeongyj
2022. 7. 12. 09:45
package com.test.jyj.shared.util;
import java.time.LocalDateTime;
public class DateTimeFormatter {
public static String LocalDateTimeToYYYYmmDD(LocalDateTime selectedDate) {
return selectedDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
public static String LocalDateTimeToYYYYmmDDHHmmSS(LocalDateTime selectedDate) {
return selectedDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss"));
}
public static String LocalDateTimeToYYYYmmDDHHmm(LocalDateTime selectedDate) {
return selectedDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm"));
}
}