Here you can find the source of dateToString(Date date, String format)
Parameter | Description |
---|---|
date | a parameter |
public static String dateToString(Date date, String format)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/* w ww .j a v a2 s . co m*/ * @param date * @return */ public static String dateToString(Date date, String format) { if (date == null) { return null; } DateFormat dateFormat = new SimpleDateFormat(format); dateFormat.setLenient(true); return dateFormat.format(date); } }