Java Hour Format formatDateForCERMe(Date date, boolean includeTime)

Here you can find the source of formatDateForCERMe(Date date, boolean includeTime)

Description

Method formatDateForCERMe.

License

Open Source License

Parameter

Parameter Description
date a parameter
includeTime a parameter

Declaration

public static String formatDateForCERMe(Date date, boolean includeTime) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /**//from w w w .  ja v a  2 s.  com
     * Method formatDateForCERMe.
     * 
     * @param date
     * @param includeTime
     * @return
     */
    public static String formatDateForCERMe(Date date, boolean includeTime) {
        if (date != null) {
            if (includeTime)
                return new SimpleDateFormat("MM-dd-yyyy hh:mm:ss a").format(date);
            else
                return new SimpleDateFormat("MM-dd-yyyy").format(date);
        } else
            return null;
    }
}

Related

  1. formatDate2DateTimeStr()
  2. formatDate3DateTimeStr(Date date)
  3. formatDateAddHMS(String strDate)
  4. formatDateAndTime(Date date)
  5. formatDateAsString(Date date)
  6. formatDateInTime(Date date)
  7. formatDateRfc822(Date date, String timeZoneId)
  8. formatDateString(Date d)
  9. formatDateString(String dateString)