Java Calendar Format format(Calendar calendar)

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

Description

format

License

Open Source License

Declaration

public static synchronized String format(Calendar calendar) 

Method Source Code


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

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

public class Main {
    private static final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yy - HH:mm:ss");

    public static synchronized String format(Date date) {
        if (date == null) {
            return null;
        }/*ww  w  .  ja v a 2s  .co  m*/
        return dateFormat.format(date);
    }

    public static synchronized String format(Calendar calendar) {
        if (calendar == null) {
            return null;
        }
        return dateFormat.format(calendar.getTime());
    }
}

Related

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