Java Date to String DateToString(Date date, String pattern)

Here you can find the source of DateToString(Date date, String pattern)

Description

Date To String

License

Apache License

Declaration

public static String DateToString(Date date, String pattern) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static String DateToString(Date date, String pattern) {
        String strDateTime = null;
        SimpleDateFormat formater = new SimpleDateFormat(pattern);
        strDateTime = date == null ? null : formater.format(date);
        return strDateTime;
    }//from   w  w  w.j a va  2s .c  om

    public static String DateToString(Date date) {
        String _pattern = "yyyy-MM-dd";
        return date == null ? null : DateToString(date, _pattern);
    }
}

Related

  1. dateToString(Date date, String format)
  2. dateToString(Date date, String format)
  3. dateToString(Date date, String format)
  4. dateToString(Date date, String formatStr)
  5. DateToString(Date date, String parttern)
  6. dateToString(Date date, String pattern)
  7. dateToString(Date date, String pattern)
  8. dateToString(Date date, String pattern)
  9. dateToString(Date date, String sPattern)