Java Calendar Format formatDate(Calendar calendar)

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

Description

Formatta una data col seguente pattern dd/MM/yyyy HH:MM:SS

License

Open Source License

Parameter

Parameter Description
calendar a parameter

Return

data formattata

Declaration

public static String formatDate(Calendar calendar) 

Method Source Code

//package com.java2s;
/**// w  w  w .j  a va2  s  . com
 *   09/feb/2011
 *
 * Copyright (c) 2010 Alten Italia, All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * Alten Italia ("Confidential Information").
 * You shall not disclose such Confidential Information and shall use it
 * only in accordance with the terms of the license agreement you entered 
 * into with Alten Italia.
 *
 * Alten Italia - MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY 
 * OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO 
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, 
 * OR NON-INFRINGEMENT. ALTEN ITALIA SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED
 * BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR 
 * ITS DERIVATIVES.
 */

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

public class Main {
    /**
     * Formatta una data col seguente pattern dd/MM/yyyy HH:MM:SS
     * 
     * @param calendar
     * @return data formattata
     */
    public static String formatDate(Calendar calendar) {
        String stringDate = null;
        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");

        if (calendar != null) {
            stringDate = sdf.format(calendar.getTime());
        }
        return stringDate;
    }
}

Related

  1. formatDate(Calendar c)
  2. formatDate(Calendar c)
  3. formatDate(Calendar cal)
  4. formatDate(Calendar cal)
  5. formatDate(Calendar cal)
  6. formatDate(Calendar date)
  7. formatDate(Calendar date)
  8. formatDate(Calendar date)
  9. formatDate(Calendar date, int precision)