Java Hour Format formatTime(Date date)

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

Description

format Time

License

LGPL

Declaration

public static String formatTime(Date date) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String formatTime(Date date) {
        return formatDate(date, "yyyy-MM-dd HH:mm:ss");
    }//from  w w w .j  a va  2s  . c o m

    public static String formatDate(Date date, String format) {
        if (date == null) {
            return "";
        }
        SimpleDateFormat simpleDateFORMat = new SimpleDateFormat(format);
        return simpleDateFORMat.format(date);
    }

    public static String formatDate(Date date) {
        return formatDate(date, "yyyy-MM-dd");
    }
}

Related

  1. formatterFor(final Thread t)
  2. formatTime(Date d)
  3. formatTime(Date d)
  4. formatTime(Date date)
  5. formatTime(Date date)
  6. formatTime(Date date)
  7. formatTime(Date date)
  8. formatTime(Date date)
  9. formatTime(Date time)