Java Date Format dateFormatTime(final Date date)

Here you can find the source of dateFormatTime(final Date date)

Description

Formats a Date to the application wide format for time

License

Apache License

Parameter

Parameter Description
date the Date to format

Return

the formated

Declaration

public static String dateFormatTime(final Date date) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static final String TIME_FORMAT = "hh:mm a";

    /**//from   w  w  w.  j  a va  2s .c  o  m
     * Formats a {@linkplain Date} to the application wide format for time
     * 
     * @param date
     *            the {@linkplain Date} to format
     * @return the formated {@linkplain Date}
     */
    public static String dateFormatTime(final Date date) {
        SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT);
        return sdf.format(date);
    }
}

Related

  1. dateformate(String reg, Date newdate)
  2. dateFormater(String dataStr, String dataFormat)
  3. dateFormatString(Date date)
  4. dateFormatted(Date date)
  5. dateFormatter(String dateFormat)
  6. dateFormatToString(Date date, String format)
  7. dateFormatToString(String source, String format)
  8. dateFormatUTC()
  9. dateTime2Str(Date date, String pattern)