Solved

date substraction issue

Posted on 2012-04-05
1
283 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 40

Accepted Solution

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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

752 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