title: How to subtract System.currentTimeMillis() from Hours+Minutes taken from timepicker?
body: <p>I want to subtract the <code>System.currentTimeMillis()</code> from Hours + Minutes taken from timepicker. However, the <code>System.currentTimeMillis()</code> is much larger as compared to Hours + Minutes converted to <code>MilliSeconds</code>.</p>
  
  <p>This is my code:</p>
  
  <pre><code>// setting my time in milliseconds. hour1 and minute1 taken from timepicker.
  app.setTimeMillisDosageTime(TimeUnit.HOURS.toMillis(hour1) + TimeUnit.MINUTES.toMillis(minute1));
  </code></pre>
  
  <p>I have a <code>TimerTask</code> where I am subtracting the <code>System.currentTimeMillis</code>.</p>
  
  <pre><code>TimerTask task = new TimerTask()
  {
      timeInMillis = app.getTimeMillisDosageTime();
      TimerTask task = new TimerTask()
      {
          @Override
          public void run()
          {
             long ellapsedMillis = timeinMillis - System.currentTimeMillis();
          }
          timer = new Timer(false);
          timer.schedule(task,0,1000);
      }
  }
  </code></pre>
  
  <p>But my <code>elapsedMillis</code> is always negative. Any solution?</p>