Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

date substraction issue

Posted on 2012-04-05
1
Medium Priority
?
288 Views
Last Modified: 2012-04-05
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(forecastTime +"-" + currentTime + "=" + diff.toString());
          } catch (Exception e) {
             e.printStackTrace();
          }
0
Comment
Question by:dpalyca755
1 Comment
 
LVL 41

Accepted Solution

by:
Kyle Abrahams earned 2000 total points
ID: 37814001
divide by 60,000 (number of miliseconds in a minute)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question