Java Calendar Format formatDate(Calendar c)

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

Description

format Date

License

Open Source License

Declaration

public static String formatDate(Calendar c) 

Method Source Code


//package com.java2s;
import java.util.*;
import java.text.SimpleDateFormat;

public class Main {
    private static String DATE_FORMAT = "dd/MM/yy HH:mm:ss";

    public static String formatDate(Calendar c) {
        if (c == null)
            return null;

        SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT);
        return df.format(c.getTime());
    }/*from  w w  w.  jav a  2 s. c  o m*/

    public static String formatDate(Date c) {
        if (c == null)
            return null;

        SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT);
        return df.format(c);
    }
}

Related

  1. formatCalendar(Calendar objCal, String strFormat)
  2. formatCalendarTS(Calendar value)
  3. formatCalendarXsdZulu(Calendar c, int millisDigits)
  4. formatDate(Calendar c)
  5. formatDate(Calendar c)
  6. formatDate(Calendar cal)
  7. formatDate(Calendar cal)
  8. formatDate(Calendar cal)
  9. formatDate(Calendar calendar)