Here you can find the source of dateToStringFormat(Date dt, String format)
Parameter | Description |
---|---|
dt | a parameter |
format | yyyy.MM.dd |
Parameter | Description |
---|---|
ParseException | an exception |
public static String dateToStringFormat(Date dt, String format)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/*from w w w . j a v a 2s. co m*/ * * @param dt * @param format yyyy.MM.dd * @return str yyyy.MM.dd"); * @throws ParseException */ public static String dateToStringFormat(Date dt, String format) { SimpleDateFormat fmt = new SimpleDateFormat(format); String dtStr = ""; if (dt != null) { dtStr = fmt.format(dt).toString(); } return dtStr; } }