Android Calendar Format formatCalendar(Calendar calendar)

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

Description

format Calendar

Declaration

public static String formatCalendar(Calendar calendar) 

Method Source Code

//package com.java2s;

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

public class Main {
    public static String DEFAULTFORMAT = "yyyy-MM-dd HH:mm:ss";

    public static String formatCalendar(Calendar calendar) {
        return formatCalendar(calendar, DEFAULTFORMAT);
    }/*from   w w w .j  a  va  2  s  . c  o m*/

    public static String formatCalendar(Calendar calendar, String pattern) {
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        // sdf.setTimeZone(TimeZone.getTimeZone(timeZone));
        return sdf.format(calendar.getTime());
    }
}

Related

  1. getFormatedDate(Calendar c, String format)
  2. string2calendar(String s, String formatString)
  3. toSimpleDate(Calendar calendar, String format)
  4. getCurrentDateString(String dateFormat)
  5. getAsString(Calendar date)
  6. formatCalendar(Calendar calendar, String pattern)
  7. formatDateTime(Calendar dateTime)
  8. getLongFriendlyDate(Calendar cal)
  9. getSelectedDate(Calendar calendar, String pattern)