2014-03-31 2 views
-6

나는 그 다음날부터 문자열로 분리하여 년, 월, 일을 구분해야하는 앱을 가지고 있습니다. 나는 TIS는Java에서 다음 날짜를 가져 오기

SimpleDateFormat day = new SimpleDateFormat("dd"); 
String Day = day.format(new Date()+1); 

또는 내가 사람들을 어떻게 얻을 수로 어떻게 든 할 수 있습니까? 나는 초보자 다.

+0

StackOverflow에 참여해 주셔서 감사합니다. 전체 초보자로서 처음 세 번의 강의 : [1] [Java 클래스 문서] (http://docs.oracle.com/javase/8/docs/api/java/time/package-summary)를 읽으십시오. html) 및 [Oracle Tutorial] (http://docs.oracle.com/javase/tutorial/datetime/TOC.html)을 참조하십시오. [2] Google을 검색하여 주제에 대해 더 많이 배우십시오. 게시하기 전에 [StackOverflow 검색] (http://stackoverflow.com/search?q=java+date+tomorrow). 귀하의 질문은 전에 여러 번 언급되었습니다. –

+0

또한 [Format date in java] (http://stackoverflow.com/q/4772425/642706) 및 [java.util.Date를 문자열로 변환] (http://stackoverflow.com/q/5683728/) 642706) 및 기타 여러. –

답변

6
SimpleDateFormat sdFormat = new SimpleDateFormat("dd"); 
Calendar calendar = Calendar.getInstance(); 
calendar.add(Calendar.DATE, 1); 
String day = sdFormat.format(calendar.getTime()) 
0

Java 8 시간 사용 API에 대한 Newer answer.

LocalDate tomorrow = LocalDate.now().plusDays(1); 
int year = tomorrow.getYear(); 
String month = tomorrow.getMonth().toString(); 
int dayOfMonth = tomorrow.getDayOfMonth();