Java Date Format As fmtTime(Date time)

Here you can find the source of fmtTime(Date time)

Description

fmt Time

License

Open Source License

Declaration

public static String fmtTime(Date time) 

Method Source Code


//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String fmtTime(Date time) {
        return fmtTime(time, "yyyy-MM-dd HH:mm:ss");
    }/*from  w w w.j a  v a2 s .  c  o  m*/

    public static String fmtTime(Date time, String pattern) {
        try {
            SimpleDateFormat sdf = new SimpleDateFormat(pattern);
            return sdf.format(time);
        } catch (Exception localException) {
        }
        return "";
    }
}

Related

  1. fmtDate(Date date)
  2. fmtDate(Date date)
  3. fmtDateTime(final Date dateTime, final String simpleDateTimeFormat)
  4. fmtMsg(final String fmt, final String arg)
  5. fmtNumStringToDouble(String s)
  6. formatDateAccordingToSessionDuration(Calendar cal, int sessionDuration, int offset)
  7. formatDateAppello(Date data)
  8. formatDateAsFileSystemName()
  9. formatDateAsYYYYMMDD(Date date)