0
나는이 코드를 웹 페이지에서 추출한 문자열을 날짜 형식으로 변환하도록 작성했습니다. 하지만 실행할 때마다 월이 01로 변환됩니다.문자열을 날짜로 변환하는 함수
이 코드를 디버깅 할 수 있습니까?
if (this.subject != null && !this.subject.isEmpty()) {
DateFormat userDateFormat = new SimpleDateFormat("dd-MM-yyyy");
Date df = DATE_FORMAT.parse(this.subject);
Calendar cal = Calendar.getInstance();
cal.setTime(df);
String theDate = String.format("%tY-%tm-%td", cal, cal, cal);
return theDate;
}
는'이 코드를 디버깅 좀 도와 주시겠습니까 도움이 될 것'* 우리가 디버깅이 코드를 *해야하는 이유? – Veluria
왜 'SimpleDateFormat'대신에'String.format (..)'을 사용하고 있습니까? –
DATE_FORMAT이 (가) 무엇입니까? –