Java Date Format formatDate(Date in)

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

Description

Formats a date in teh format yyyy-MM-dd

License

Apache License

Parameter

Parameter Description
in a parameter

Return

formatted date

Declaration

public static String formatDate(Date in) 

Method Source Code


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

import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /**/*  w w w . ja  v a 2 s.c  o  m*/
     * Formats a date in teh format yyyy-MM-dd
     *
     * @param in
     * @return formatted date
     */
    public static String formatDate(Date in) {
        if (in == null) {
            return null;
        }
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        return dateFormat.format(in);
    }
}

Related

  1. formatDate(Date date)
  2. formatDate(Date date, DateFormat dateFormat, char delimiter, boolean endWithDelimiter)
  3. formatDate(Date date, Locale locale)
  4. formatDate(Date date, SimpleDateFormat dateFormat)
  5. formatDate(Date fecha)
  6. formatDate(Date myDate)
  7. formatDate(Date pDate, boolean pShowDateOnly)
  8. formatDate(Date t)
  9. formatDate(Date tagValue)