Java Date to String date2String(Date source, String formatString)

Here you can find the source of date2String(Date source, String formatString)

Description

date String

License

Apache License

Declaration

public static String date2String(Date source, String formatString) 

Method Source Code


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

import java.text.DateFormat;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String date2String(Date source, String formatString) {
        return date2String(source, new SimpleDateFormat(formatString));
    }// www.  j  a  v  a  2 s.co m

    public static String date2String(Date source, DateFormat format) {
        try {
            return format.format(source);
        } catch (Exception e) {
            return "";
        }
    }
}

Related

  1. date2string(Date date, String format)
  2. date2String(Date date, String format)
  3. date2String(Date date, String format)
  4. Date2String(Date date, String formatPattern)
  5. date2String(Date date, String pattern)
  6. date2String(Date value)
  7. date2String(java.util.Date date, String format)
  8. date2String(java.util.Date date, String pattern)
  9. date2String(String formater, Date aDate)