Android Date to String Convert getFormatString(Date date, String dateFormat)

Here you can find the source of getFormatString(Date date, String dateFormat)

Description

get Format String

Declaration

public static String getFormatString(Date date, String dateFormat) 

Method Source Code

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

public class Main{
    public static String getFormatString(Date date, String dateFormat) {
        if (date == null || StringUtil.isEmpty(dateFormat)) {
            return null;
        }/*from w  w w.  jav  a2s.  co m*/

        return new SimpleDateFormat(dateFormat, Locale.ENGLISH)
                .format(date);
    }
}

Related

  1. getCurrentTimeStr()
  2. getDateByFormatedString(String date)
  3. getDateTimeString(Date date)
  4. getDateTimeString(Date date, int format, Locale currentLocale)
  5. getFileName()
  6. getHourInFloat(Date date)
  7. getLongDateStr(Date date)
  8. getLongFormat(Date date)
  9. getShortDateTimeString(Date date)