1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | /** * <PRE> * Calendar Time을 DB형태 시간 문자열로 [시간(21),분(19),초(43),밀리초(304)] ("211943304") <br> * ClassName : CalendarUtil <br> * MethodName : gCalToDBTimeString2 <br> * 처리내용 : * - Biz Logic (간략) * Calendar Time을 DB형태 시간 문자열로 [시간(21),분(19),초(43),밀리초(304)] ("211943304") * </PRE> * @return String * @param cal GregorianCalendar 객체 */ public static String gCalToDBTimeString2(GregorianCalendar cal) { int hour = cal.get(GregorianCalendar.HOUR_OF_DAY); int minute = cal.get(GregorianCalendar.MINUTE); int second = cal.get(GregorianCalendar.SECOND); int millisecond = cal.get(GregorianCalendar.MILLISECOND); return ((hour < 10) ? "0" + hour : Integer.toString(hour)) + ((minute < 10) ? "0" + minute : Integer.toString(minute)) + ((second < 10) ? "0" + second : Integer.toString(second)) + ((millisecond < 10) ? "0" + millisecond : Integer.toString(millisecond)); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | /** * <PRE> * Calendar Date를 DB형태 날짜 문자열로 ("20000415") <br> * ClassName : CalendarUtil <br> * MethodName : gCalToDBDayString <br> * 처리내용 : * - Biz Logic (간략) * Calendar Date를 DB형태 날짜 문자열로 ("20000415") * </PRE> * @return String * @param cal GregorianCalendar 객체 */ public static String gCalToDBDayString(GregorianCalendar cal) { int year = cal.get(GregorianCalendar.YEAR); int month = cal.get(GregorianCalendar.MONTH) + 1; int date = cal.get(GregorianCalendar.DATE); return Integer.toString(year) + ((month < 10) ? "0" + month : Integer.toString(month)) + ((date < 10) ? "0" + date : Integer.toString(date)); } |
댓글 없음:
댓글 쓰기