Java Calendar Format formatDate(Calendar date)

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

Description

Format a date to YYYY-MM-dd format

License

Open Source License

Parameter

Parameter Description
date The date

Return

The formatted date

Declaration

@Deprecated
public static String formatDate(Calendar date) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;

import java.util.Calendar;

public class Main {
    /**/*  w  ww .j  a v  a  2  s  .co m*/
     * A formatter for generating date strings. The output format is
     * {@code YYYY-MM-DD}.
     */
    private static SimpleDateFormat dateFormatter = null;

    /**
     * Format a date to YYYY-MM-dd format
     * @param date The date
     * @return The formatted date
     */
    @Deprecated
    public static String formatDate(Calendar date) {
        return dateFormatter.format(date.getTime());
    }
}

Related

  1. formatDate(Calendar c)
  2. formatDate(Calendar cal)
  3. formatDate(Calendar cal)
  4. formatDate(Calendar cal)
  5. formatDate(Calendar calendar)
  6. formatDate(Calendar date)
  7. formatDate(Calendar date)
  8. formatDate(Calendar date, int precision)
  9. FormatDate(Calendar p_date, String p_separator)