Here you can find the source of convertDateToString(Date date, String dateFormat)
Parameter | Description |
---|---|
date | a parameter |
dateFormat | a parameter |
public static final String convertDateToString(Date date, String dateFormat)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**// w w w .java 2s.c om * * @param date * @param dateFormat * @return */ public static final String convertDateToString(Date date, String dateFormat) { if (date == null) { return null; } SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); String dateStr = sdf.format(date); return dateStr; } }