Java Parse Date Pattern YYYY parseCalendar2String(Calendar calendar)

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

Description

parse Calendar String

License

Open Source License

Declaration

public static String parseCalendar2String(Calendar calendar) 

Method Source Code


//package com.java2s;

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

public class Main {
    private static final String PATTERN = "yyyy-MM-dd";

    public static String parseCalendar2String(Calendar calendar, String pattern) {
        return parseDate2String(calendar.getTime(), pattern);
    }//from  www  .  j ava 2  s.  c om

    public static String parseCalendar2String(Calendar calendar) {
        return parseCalendar2String(calendar, null);
    }

    public static String parseDate2String(Date date, String pattern) {
        return getSimpleDateFormatInstance(pattern).format(date);
    }

    public static String parseDate2String(Date date) {
        return parseDate2String(date, null);
    }

    private static SimpleDateFormat getSimpleDateFormatInstance(String pattern) {
        return new SimpleDateFormat(pattern == null ? PATTERN : pattern);
    }
}

Related

  1. parseAscTime(String date)
  2. parseAsDateTime(String date)
  3. parseAtomDate(String date_str)
  4. parseBingDate(String dateString)
  5. parseBitcoin(String calendarString)
  6. parseCalendarString(String dateTimeString)
  7. parseCDADateFormat(String xsdDate)
  8. parseCompactDate(String exp)
  9. parseCoTDate(String dateString)