Java Calendar to String toString(Calendar cal)

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

Description

Get a String representation of the Calendar with its date and time

License

Open Source License

Parameter

Parameter Description
cal the Calendar to format

Return

String representation of Calendar

Declaration

public static String toString(Calendar cal) 

Method Source Code

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

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

public class Main {
    /**/* www. j  a  va  2 s  .co  m*/
     * Get a String representation of the Calendar with its
     * date and time
     * @param cal the Calendar to format
     * @return String representation of Calendar
     */
    public static String toString(Calendar cal) {
        SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z");
        return sdf.format(cal.getTime());
    }
}

Related

  1. getDateString(Calendar cal)
  2. getDateString(Calendar calendar)
  3. getDateToString(Calendar argCal)
  4. getString(Calendar calendar)
  5. toString(Calendar c)
  6. toString(Calendar cal)
  7. toString(Calendar cal)
  8. toString(Calendar calendar)
  9. toString(final Calendar calendar, final String format)