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

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

Description

date To String

License

Open Source License

Declaration

public static String dateToString(Date date, String formartStr) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {

    public static String dateToString(Date date, String formartStr) {
        String strDate = null;//from ww w . jav  a  2  s.c  o  m

        if ((formartStr != null) && (!"".equals(formartStr))) {
            SimpleDateFormat sdf = new SimpleDateFormat(formartStr);
            strDate = sdf.format(date);
        }
        return strDate;
    }
}

Related

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