Ver Mensaje Individual
  #3 (permalink)  
Antiguo 02/05/2015, 18:51
Avatar de soy_nicanor
soy_nicanor
 
Fecha de Ingreso: mayo-2010
Mensajes: 374
Antigüedad: 14 años
Puntos: 3
Respuesta: Como restar time

No me resta.

Código Java:
Ver original
  1. try {
  2.             Date fechaInicio=new SimpleDateFormat("HH:mm:ss").parse(time1);
  3.             Date fechaFin=new SimpleDateFormat("HH:mm:ss").parse(time2);
  4.            
  5.             long tiempoInicial=fechaInicio.getTime();
  6.             long tiempoFinal=fechaFin.getTime();
  7.             long resta=tiempoFinal - tiempoInicial;
  8.             //el metodo getTime te devuelve en mili segundos para saberlo en mins debes hacer
  9.             //            resta=((resta/3600000) * 3600000); ///(1000*60);
  10.             String ress = new SimpleDateFormat("HH:mm:ss").format(resta);
  11.             this.jTextField3.setText(ress);
  12.         } catch (ParseException ex) {
  13.             Logger.getLogger(Borrar1.class.getName()).log(Level.SEVERE, null, ex);
  14.         }
__________________
Muy Feliz