관리 메뉴

웹개발 블로그

[java] String TO Date 형변환(jstl 날짜 포맷 사용하려는데 계속 에러) 본문

◆JAVA/에러

[java] String TO Date 형변환(jstl 날짜 포맷 사용하려는데 계속 에러)

쿠키린 2023. 4. 11. 09:58

jsp에서 jstl 날짜 포맷 사용하려는데 계속 에러가 발생.

💥String 자료형이었기 때문에 발생한 에러.

Date 자료형으로 변환을 해주고 보내주었다.

나같은 경우는 GETTER에서 변환하여 보내주었다.

public class StringToDate {

    public static Date change(String msg) {
        Date tempDate = null;
        try {
        DateFormat sdFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        tempDate = sdFormat.parse(msg);
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
        return tempDate;
    }
}

'◆JAVA > 에러' 카테고리의 다른 글

[에러]version TLS10 is not accepted by client preference  (0) 2024.09.03