private void startDate(String selected_date) {
if (selected_date != null && selected_date != "0") {
Calendar mcurrentDate = Calendar.getInstance();
Calendar calendar = Calendar.getInstance();
int selectDate = Integer.parseInt(selected_date);
mcurrentDate.add(Calendar.MONTH, 1);
mcurrentDate.set(Calendar.DAY_OF_MONTH, selectDate);
long diff = mcurrentDate.getTimeInMillis() - calendar.getTimeInMillis();
long days = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
if (days < 60) {
mcurrentDate.add(Calendar.MONTH, 1);
long yourmilliseconds = mcurrentDate.getTimeInMillis();
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy HH:mm");
Date resultdate = new Date(yourmilliseconds);
Log.e("day60", sdf.format(resultdate));
} else {
long yourmilliseconds = mcurrentDate.getTimeInMillis();
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy HH:mm");
Date resultdate = new Date(yourmilliseconds);
Log.e("elseday60", String.valueOf(mcurrentDate.getTimeInMillis()));
}
}
}
I NEED IF USER PUT 9TH in date THEN IT SHOULD REVERT BACK date BETWEEN 60 TO 90Days date not in between 0 to 30days date