Java String to Date toDateString(Calendar cal)

Here you can find the source of toDateString(Calendar cal)

Description

to Date String

License

Open Source License

Parameter

Parameter Description
cal a parameter

Declaration

public static synchronized String toDateString(Calendar cal) 

Method Source Code


//package com.java2s;

import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Calendar;

public class Main {
    public static DateFormat ibmDateFormat = new SimpleDateFormat("yyyy-MM-dd");

    /**//  w  w  w . j a v  a2s .  c  om
     * @param cal
     * @return
     */
    public static synchronized String toDateString(Calendar cal) {
        if (cal != null) {
            return ibmDateFormat.format(cal.getTime());
        }
        return null;
    }
}

Related

  1. toDateFormat(Integer grain, TimeZone timeZone, String dateFormatArg)
  2. toDateFormat(String date)
  3. toDateFormat(String dateFormat, TimeZone tz, Locale locale)
  4. toDateOracle(Date d, String format, String hqlFormat)
  5. toDates(DateFormat format, String[] values)
  6. toDateString(Date date)
  7. toDateString(Date date)
  8. toDateString(Date date)
  9. toDateString(Date date, String format)