본문 바로가기

(Java) 특정 날짜의 요일을 구하는 함수 Date 객체를 던져서 요일을 구할 수 있는 함수를 소개합니다. Utility 클래스 등으로 빼서 유용하게 사용할 수 있습니다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 //Date 기반으로 요일을 구할 수 있는 함수 public static String getDateDay(Date date) throws Exception { String day = null; Calendar cal = Calendar.getInstance(); cal.setTime(date); int dayNum = cal.get(Calendar.DAY_OF_WEEK); switch(dayNum){ case.. 더보기
에러 해결 방법 - java.lang.IllegalArgumentException: Illegal pattern character 'Y' java.text.SimpleDateFormat을 사용할 때 다음과 같은 에러가 나는 경우가 있다. java.lang.IllegalArgumentException: Illegal pattern character 'Y' JAVA 8 이상에서는 SimpleDateFormat에서 Y(대문자)를 쓸 수 있지만 JAVA 7 이하에서는 Y(대문자)를 인지를 못해서 y(소문자)를 써야만 한다! 소문자 y를 사용하면 깔끔하게 해결된다. 더보기
에러 해결 방법 - weblogic.net.http.SOAPHttpsURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection weblogic에서 HttpsURLConnection을 사용할 때 다음과 같은 에러가 나는 경우가 있다. java.lang.ClassCastException: weblogic.net.http.SOAPHttpsURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection openConnection()을 할 때 weblogic이 SOAPHttpsURLConnection을 리턴해버리기 때문이다. 해결 방법은 생각보다 간단하다. URL 객체를 생성할 때 다음과 같은 형태로 sun.net.www.protocol.https.Handler 핸들러를 삽입해주면 webloginc이 openConnection()을 할 때 HttpsURLConnection을 리턴하도록 .. 더보기