Java Hour Format formatTime(Date d)

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

Description

format Time

License

Open Source License

Declaration

public static String formatTime(Date d) 

Method Source Code


//package com.java2s;
import java.util.*;
import java.text.SimpleDateFormat;

public class Main {
    private static String TIME_FORMAT = "HH:mm:ss";

    public static String formatTime(Calendar c) {
        if (c == null)
            return null;

        SimpleDateFormat df = new SimpleDateFormat(TIME_FORMAT);
        return df.format(c.getTime());
    }//from ww w.j a v  a  2  s.c  o m

    public static String formatTime(Date d) {
        if (d == null)
            return null;

        SimpleDateFormat df = new SimpleDateFormat(TIME_FORMAT);
        return df.format(d);
    }
}

Related

  1. formattedTime(long epochTime)
  2. formattedTimeForFilenames()
  3. formatterDate(Date date, byte format)
  4. formatterFor(final Thread t)
  5. formatTime(Date d)
  6. formatTime(Date date)
  7. formatTime(Date date)
  8. formatTime(Date date)
  9. formatTime(Date date)