Java Time Format getTimeByDate(Date date, String timeFormat)

Here you can find the source of getTimeByDate(Date date, String timeFormat)

Description

get Time By Date

License

Open Source License

Declaration

public static String getTimeByDate(Date date, String timeFormat) 

Method Source Code

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

import java.text.SimpleDateFormat;
import java.util.*;

public class Main {
    public static String getTimeByDate(Date date) {
        return getTimeByDate(date, null);
    }//  w  w w.  j  av  a2 s.c o m

    public static String getTimeByDate(Date date, String timeFormat) {
        if (date == null)
            return null;
        if (timeFormat == null) {
            timeFormat = "MM/dd/yyy hh:mm:ss";
        }
        return new SimpleDateFormat(timeFormat).format(date);
    }
}

Related

  1. getTime(String format, String date)
  2. getTime(String timeFormat)
  3. getTimeAfter(int field, int amount, String formatStr)
  4. getTimeAsString(final Date date, final String format)
  5. getTimeAsString(String timeFormatAsString)
  6. getTimeByFormat(Date date, String format)
  7. getTimeCount(String from, String to, String format)
  8. getTimeCount(String from, String to, String format)
  9. getTimeFormat()