我有两个字符串格式的日期。我需要在几天内得到这两个日期之间的差异。我如何得到它?我对这些日期format.please新非常新我有任何建议。以字符串格式计算两个日期之间的日期差异
2017-06-13
2017-06-27
String newDate = null;
Date dtDob = new Date(GoalSelectionToDate);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
newDate = sdf.format(dtDob);
String newDate1 = null;
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
newDate1 = sdf1.format(currentDate);
System.out.println("currentdateformat"+newDate1);
System.out.println("anotherdateformat"+newDate);
这是否有帮助 - https://stackoverflow.com/questions/13732577/convert-string-to-date-to-calculate-the-difference –
可能的重复[转换字符串到日期以计算差异](https: //sackoverflow.com/questions/13732577/convert-string-to-date-to-calculate-the-difference) – Tom