Android Date Format getFormatedDate(Date date, String format)

Here you can find the source of getFormatedDate(Date date, String format)

Description

used to convert the specified date to the specified format

Parameter

Parameter Description
date date to be formatted
format format string specifying the required format of date

Return

returns string containing date in the specified format

Declaration

public static String getFormatedDate(Date date, String format) 

Method Source Code

//package com.java2s;
import java.text.DateFormat;

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

public class Main {
    /**//from  w  ww  .  ja v a2 s. c o m
     * used to convert the specified date to the specified format
     * 
     * @param date date to be formatted
     * @param format format string specifying the required format of date
     * @return returns string containing date in the specified format
     */
    public static String getFormatedDate(Date date, String format) {
        DateFormat dateFormat = new SimpleDateFormat(format,
                Locale.getDefault());
        return dateFormat.format(date);
    }
}

Related

  1. formatData(Date date)
  2. formatDate(final Date date)
  3. getStringFromDate(Date date, String format)
  4. getFormatTomorrow(String format)
  5. getDisplayDate(Date date, String format)
  6. dateFormat(String sdate, String format)
  7. dateFormat(String sdate, String format)
  8. formatcurrentDate(int format)
  9. formatDataTime(Date date)