Android Date Format convertDateToString(Date date)

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

Description

convert Date To String

Declaration

public static String convertDateToString(Date date) 

Method Source Code

//package com.java2s;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static String convertDateToString(Date date) {
        String result = "";

        //SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy");
        SimpleDateFormat format = new SimpleDateFormat(
                "yyyy-MM-dd HH:mm:ss");

        try {//from w  w w.j a  v  a  2s . co m
            result = format.format(date);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return result;
    }
}

Related

  1. getFormatDateString(String format, java.util.Date date)
  2. getFormatDateTime(String formatString, Date d)
  3. formatDateToString(Date timestamp)
  4. getStringByFormat(Date date, String format)
  5. getStringByFormat(Date date, String format)
  6. formatDate(Date date)
  7. now(String dateFormat)
  8. now(String dateFormat)
  9. getLongFriendlyDate(Date dt)