Java Date Format convertDateToStringByFormat(Date date)

Here you can find the source of convertDateToStringByFormat(Date date)

Description

convert Date To String By Format

License

Open Source License

Declaration

public static String convertDateToStringByFormat(Date date) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static String convertDateToStringByFormat(Date date) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.format(date);
    }//from  w w  w  . j a  va 2  s  .com

    public static String convertDateToStringByFormat(Date date, String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(date);
    }
}

Related

  1. convertDateToString(Date date, String format)
  2. convertDateToString(Date date, String pattern)
  3. convertDateToString(Date date, String pattern)
  4. convertDateToString(Date date, String patternString, Locale locale)
  5. convertDateToString(Date dateObject, String dateFormat)
  6. convertDateToStringT(final Date date)
  7. convertDateToStringUI(Date data)
  8. convertDateToText(Date date)
  9. convertDateToUTC(Date date)