Solved

date substraction issue

Posted on 2012-04-05
1
269 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 39

Accepted Solution

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now