Java Date Format convertDateToCustomFormat(Date date, String datePattern)

Here you can find the source of convertDateToCustomFormat(Date date, String datePattern)

Description

convert Date To Custom Format

License

Apache License

Declaration

public static String convertDateToCustomFormat(Date date, String datePattern) throws ParseException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public static String convertDateToCustomFormat(Date date, String datePattern) throws ParseException {
        SimpleDateFormat dateFormatCustom = new SimpleDateFormat(datePattern);
        String dateInCustomFormat = dateFormatCustom.format(date);

        return dateInCustomFormat;
    }//ww  w  .  ja va  2 s. c o m
}

Related

  1. convertDateToBulgarianFormat(Date date)
  2. convertDateToDateString(Date date)
  3. convertDateToFileName(final Date datum)
  4. convertDateToGMTDateString(Date date)
  5. convertDateToHour(Date d)