Java Date to String date2String(Date date, String format)

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

Description

date String

License

Open Source License

Declaration

public static String date2String(Date date, String format) 

Method Source Code


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

import java.text.SimpleDateFormat;
import java.util.*;

public class Main {
    public static String date2String(Date date) {
        if (date == null)
            return "";
        SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");

        return format.format(date);
    }/*from  w w w .  java2 s.  com*/

    public static String date2String(Date date, String format) {
        if (date == null)
            return "";
        SimpleDateFormat sdformat = new SimpleDateFormat(format);
        return sdformat.format(date);
    }
}

Related

  1. date2String(Date date, DateFormat dateFormat)
  2. date2String(Date date, int _iType)
  3. Date2String(Date date, String DateFormat)
  4. date2string(Date date, String format)
  5. date2String(Date date, String format)
  6. Date2String(Date date, String formatPattern)
  7. date2String(Date date, String pattern)
  8. date2String(Date source, String formatString)
  9. date2String(Date value)