Java Date to Time getTime(java.util.Date date)

Here you can find the source of getTime(java.util.Date date)

Description

get Time

License

Open Source License

Declaration

public static String getTime(java.util.Date date) 

Method Source Code

//package com.java2s;

public class Main {

    public static String getTime(java.util.Date date) {
        return format(date, "HH:mm:ss");

    }//from   w w  w.  j  a v a  2  s .c  o m

    public static String format(java.util.Date date, String format) {
        String result = "";

        try {
            if (date != null) {
                java.text.DateFormat df = new java.text.SimpleDateFormat(format);

                result = df.format(date);

            }
        } catch (Exception e) {
        }
        return result;

    }

    public static String format(java.util.Date date) {
        if (date == null) {
            return "";
        }
        return format(date, "yyyy/MM/dd");

    }
}

Related

  1. getTime(Date timestamp)
  2. getTime(Date trialTime)
  3. getTime(final Date date, final int day)
  4. getTime(final Date time)
  5. getTime(java.util.Date date)
  6. getTime(java.util.Date date)
  7. getTimeAsMilliSeconds(Date dateTime)
  8. getTimeAsString(Date date)
  9. getTimeAsXsdDateTime(Date d)