Android Time Get getTimeStr(Date date)

Here you can find the source of getTimeStr(Date date)

Description

Returns "22:00" for param "2014-02-09 22:00"

Parameter

Parameter Description
date the datetime

Return

time str

Declaration

public static String getTimeStr(Date date) 

Method Source Code

//package com.java2s;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    final static DateFormat HOUR_DATE_FORMAT = new SimpleDateFormat("HH:mm");

    /**/*from  w  w  w.ja  va  2  s.c  o m*/
     * Returns "22:00" for param "2014-02-09 22:00"
     *
     * @param date the datetime
     * @return time str
     */
    public static String getTimeStr(Date date) {
        return HOUR_DATE_FORMAT.format(date);
    }
}

Related

  1. getDate(String time)
  2. getDateLabel(long time)
  3. getDateTime()
  4. getDateTime(String format)
  5. getDateTimeFromCal(Calendar cal)
  6. getTimeString(String strTime)
  7. getNowDateTime()
  8. getTimeAsInt()
  9. nowAsTime()