Java Date Format formatDate(Date date)

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

Description

Formats a date and time as (for example) "02/06/02 10:32 AM".

License

Open Source License

Parameter

Parameter Description
date The date and time.

Return

The formatted date and time.

Declaration


public static String formatDate(Date date) 

Method Source Code


//package com.java2s;
/*   Please see the license information at the end of this file. */

import java.util.*;

import java.text.*;

public class Main {
    /**   Date formatter for dates and times in format e.g. 02/06/02 10:32 AM. */

    static private final SimpleDateFormat dateFormatter1 = new SimpleDateFormat("MM/dd/yy hh:mm aa");

    /**   Formats a date and time as (for example) "02/06/02 10:32 AM".
     */* w  w w.  j a v  a 2  s  . c o  m*/
     *   @param   date      The date and time.
     *
     *   @return            The formatted date and time.
     */

    public static String formatDate(Date date) {
        return dateFormatter1.format(date);
    }
}

Related

  1. formatDate(Date date)
  2. formatDate(Date date)
  3. formatDate(Date date)
  4. formatDate(Date date)
  5. formatDate(Date date)
  6. formatDate(Date date)
  7. formatDate(Date date)
  8. formatDate(Date date)
  9. formatDate(Date date)