yyyyMMdd 로 입력 받음
private String nextDate(String date) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
Calendar c = Calendar.getInstance();
Date d = sdf.parse(date);
c.setTime(d);
c.add(Calendar.DATE,1);
String nextDay = sdf.format(c.getTime());
return nextDay;
}
private String preDate(String date) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
Calendar c = Calendar.getInstance();
Date d = sdf.parse(date);
c.setTime(d);
c.add(Calendar.DATE,-1);
String preDay = sdf.format(c.getTime());
return preDay;
}
'안드로이드' 카테고리의 다른 글
rxjava 파일 다운로드 (0) | 2023.11.13 |
---|---|
코틀린 apply, run, let (0) | 2023.11.10 |
Glide 큰 사이즈 이미지 로딩 (0) | 2023.09.19 |
안드로이드 이미지 업로드 PHP (0) | 2023.07.27 |
php 다른 테이블의 리스트를 가져오기 (0) | 2022.11.11 |