Java Date to String dateToString(Date date, String dateFormat)

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

Description

date To String

License

LGPL

Declaration

public static String dateToString(Date date, String dateFormat) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static String dateToString(Date date, String dateFormat) {
        if (date == null)
            return "";
        try {/*ww  w  . j a v a 2 s  . c  om*/
            return new SimpleDateFormat(dateFormat).format(date);
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }
}

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, String formartStr)
  7. dateToString(Date date, String format)
  8. dateToString(Date date, String format)
  9. dateToString(Date date, String format)