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

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

Description

datestring

License

Apache License

Declaration

public static String date2string(Date date, String format) 

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 date2string(Date date, String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        String result = sdf.format(date);
        sdf = null;//from   w w w. jav  a  2s  .  com
        return result;
    }

    public static String date2string(Date date) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String result = sdf.format(date);
        sdf = null;
        return result;
    }
}

Related

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