Java Timestamp Field getHoraHHMM(Timestamp dataHoraRef)

Here you can find the source of getHoraHHMM(Timestamp dataHoraRef)

Description

get Hora HHMM

License

Open Source License

Declaration

public static String getHoraHHMM(Timestamp dataHoraRef) 

Method Source Code


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

import java.sql.Timestamp;

import java.util.GregorianCalendar;

public class Main {
    public static String getHoraHHMM(Timestamp dataHoraRef) {
        // cria um StringBuilder
        StringBuilder sb = new StringBuilder();
        // cria um GregorianCalendar que vai conter a hora atual
        GregorianCalendar d = new GregorianCalendar();
        d.setTime(dataHoraRef);/*  w  ww.j a v a2  s.  c  o m*/

        String aux = "" + d.get(GregorianCalendar.HOUR_OF_DAY);
        if (aux.length() < 2)
            aux = "0" + aux;
        sb.append(aux);

        aux = "" + d.get(GregorianCalendar.MINUTE);
        if (aux.length() < 2)
            aux = "0" + aux;
        sb.append(":");
        sb.append(aux);

        return sb.toString();
    }
}

Related

  1. getEndTimeStampOfDate(Date date)
  2. getFormattedDateTimeColumn(final Timestamp ts, final SimpleDateFormat formatDate)
  3. getFormattedTimeStamp(long millisSince1970)
  4. getFromTimestamp(Timestamp timestamp)
  5. getHms(Timestamp timestamp)
  6. getInterval(ArrayList times)
  7. getIntervalInDays(Timestamp from, Timestamp thru)
  8. getISOTimeStampStringFormat(Timestamp ts)
  9. getKDCTStoTimestamp(short[] in)