Java Hour Format formatTime(Date date)

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

Description

Formats the given date in the format of "hh:mm:ss.SSSS".

License

Open Source License

Parameter

Parameter Description
date <code>Date</code> to be formatted.

Return

formatted date or null if parameter is null.

Declaration

public static String formatTime(Date date) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /**/*  ww w  .jav a  2 s.  c om*/
     * Formats the given date in the format of "hh:mm:ss.SSSS".
     * 
     * @param date <code>Date</code> to be formatted.
     * @return formatted date or null if parameter is null.
     */
    public static String formatTime(Date date) {
        if (date != null) {
            return (new SimpleDateFormat("hh:mm:ss.SSSS")).format(date);
        }
        return null;
    }
}

Related

  1. formatTime(Date d)
  2. formatTime(Date date)
  3. formatTime(Date date)
  4. formatTime(Date date)
  5. formatTime(Date date)
  6. formatTime(Date date)
  7. formatTime(Date time)
  8. formatTime(Date time)
  9. formatTime(double s)