dpalyca755
asked on
date substraction issue
The following code is producing a difference of "300000".
I am trying to get "05". What am I doing wrong or what additional step do I need?
Code Snippet:
String Time1 = "2011-09-21T22:30:00Z";
String Time2 = "2011-09-21T22:35:00Z";
DateFormat dfm = new SimpleDateFormat("yyyy-MM- dd'T'HH:mm :ss'Z'");
try {
long a = dfm.parse(Time1).getTime() ;
long b = dfm.parse(Time2).getTime() ;
long c = (b-a);
Long diff = new Long(c);
System.out.println(forecas tTime +"-" + currentTime + "=" + diff.toString());
} catch (Exception e) {
e.printStackTrace();
}
I am trying to get "05". What am I doing wrong or what additional step do I need?
Code Snippet:
String Time1 = "2011-09-21T22:30:00Z";
String Time2 = "2011-09-21T22:35:00Z";
DateFormat dfm = new SimpleDateFormat("yyyy-MM-
try {
long a = dfm.parse(Time1).getTime()
long b = dfm.parse(Time2).getTime()
long c = (b-a);
Long diff = new Long(c);
System.out.println(forecas
} catch (Exception e) {
e.printStackTrace();
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.