I have two String date 8-11-2011 and 8-12-2011 . I want to compute days between tw开发者_Go百科o string . How can I do that ? I don't want to use Joda API . Please explain with example .
I don't know if you have any direct api for this but you can do this,
String s1 = "8-11-2011";
String s2 = "8-12-2011";
String[] arr1 = s1.split("-");
String[] arr2 = s2.split("-");
for(int i = 0; i<arr1.length; i++){
Integer diff = Integer.valuof(arr1[i])-Integer.valueOf(arr2[i])// its just an idea. you may need if conditions here
}
and its not reliable..
please refer to this for the problem solution
精彩评论