[날짜 계산을 위한 변환]
String edate = "2016-12-01";
int year = Integer.valueOf(edate.substring(0, 4));
int month = Integer.valueOf(edate.substring(5, 7));
int day = Integer.valueOf(edate.substring(8, 10));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.set(year, month-1, day-1);
String date = sdf.format(c.getTime());
[단순 변환]
String edate = "2016-12-01";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date ndate = sdf.parse(edate);
Calendar c = Calendar.getInstance();
c.setTime(ndate);
String date = sdf.format(c.getTime());
댓글 없음:
댓글 쓰기