Java yyyy formatDateNoTime(Date date)

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

Description

Formats a date as (for example) "2/6/2002".

License

Open Source License

Parameter

Parameter Description
date The date.

Return

The formatted date.

Declaration


public static String formatDateNoTime(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 in format e.g. 2/6/2002. */

    static private final SimpleDateFormat dateFormatter2 = new SimpleDateFormat("M/d/yyyy");

    /**   Formats a date as (for example) "2/6/2002".
     *//from  ww  w.  j  ava2  s. c o  m
     *   @param   date      The date.
     *
     *   @return            The formatted date.
     */

    public static String formatDateNoTime(Date date) {
        return dateFormatter2.format(date);
    }
}

Related

  1. formatDate2DateStr()
  2. formatDate2ShortStr(Date date)
  3. formatDate2Str(Date date)
  4. formatDateAsShortDateLocalTime(Date moonDate, TimeZone tz)
  5. formatDateFromStringToString(String str)
  6. formatDateString(java.util.Date date, String format)
  7. formatDateToString(Date d)
  8. formatDateToString(String strDate)
  9. formatDicomDate(String dicomDate)