프로그래밍/jsp/servlet

현재 날짜 얻어오기

세틴 2009. 3. 18. 11:38
GregorianCalendar cal = new GregorianCalendar();
           
SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-DD");

sdf.format(cal.getTime());



Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-DD");

sdf.format(date);
요래 해도 됨. 이게 더 간단한듯..