Java Minute Calculate toMinutes(Date fecha)

Here you can find the source of toMinutes(Date fecha)

Description

to Minutes

License

Open Source License

Declaration

public static Long toMinutes(Date fecha) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static Long toMinutes(Date fecha) {
        String sFecha = toTime(fecha);
        long horas = Long.parseLong(sFecha.substring(0, 2));
        long minutos = Long.parseLong(sFecha.substring(3));
        minutos = horas * 60 + minutos;//from   www .  j  av  a 2s.  c o m
        return minutos;
    }

    public static String toTime(Date fecha) {
        String time = "00:00";
        if (fecha != null) {
            SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
            time = sdf.format(fecha);
        }
        return time;
    }
}

Related

  1. plusMinute(Date date, int minutes)
  2. plusMinute(int minute)
  3. setMinutes(Date date, int amount)
  4. shiftTime(Object o, int minutes)
  5. toDegreesMinutes(double degrees, int nDecimals, boolean longitude)
  6. toMinuteString(long time)