Java Calendar Format format(Calendar calendar)

Here you can find the source of format(Calendar calendar)

Description

format a calendar using SimpleDateFormat , with default pattern.

License

Apache License

Parameter

Parameter Description
calendar a parameter

Declaration

public static String format(Calendar calendar) 

Method Source Code

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

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main {
    /**//from  ww w . j a  v a  2 s.  c  o m
     * format a calendar using {@link SimpleDateFormat}, with default pattern.
     * if a null calendar is passed in, empty string is returned.
     *
     * @param calendar
     * @return
     */
    public static String format(Calendar calendar) {
        String formatted = "";
        if (calendar != null) {
            formatted = new SimpleDateFormat().format(calendar.getTime());
        }
        return formatted;
    }
}

Related

  1. format(Calendar cal)
  2. format(Calendar cal, String format)
  3. format(Calendar cal, String pattern)
  4. format(Calendar calendar)
  5. format(Calendar calendar)
  6. format(Calendar calendar)
  7. format(Calendar calendar)
  8. format(Calendar calendar)
  9. format(Calendar calendar, String format)