Java Date to String dateToString(Date date)

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

Description

date To String

License

Apache License

Declaration

public static String dateToString(Date date) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.Locale;

public class Main {
    public static final String DEFAULT_DATE_FORMATE = "yyyy-MM-dd HH:mm:ss";

    public static String dateToString(Date date) {

        if (date == null)
            return "";
        else {/*from  w  w  w. j a  v  a  2 s . c  o  m*/
            SimpleDateFormat sdFormat = new SimpleDateFormat(DEFAULT_DATE_FORMATE, Locale.getDefault());
            String str_Date = sdFormat.format(date);
            return str_Date;
        }
    }
}

Related

  1. dateToString(Date date)
  2. dateToString(Date date)
  3. dateToString(Date date)
  4. DateToString(Date date)
  5. dateToString(Date date)
  6. dateToString(Date date)
  7. dateToString(Date date, String dateFormat)
  8. dateToString(Date date, String formartStr)
  9. dateToString(Date date, String format)