Here you can find the source of ConvertToString(Date date, String format)
Parameter | Description |
---|---|
date | Date object |
format | String format |
public static String ConvertToString(Date date, String format)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.text.SimpleDateFormat; import java.util.*; public class Main { /** Converts a date object to a string using the specified format. */*w w w . j a va 2 s. c o m*/ * @param date Date object * @param format String format * @return Formatted date/time */ public static String ConvertToString(Date date, String format) { SimpleDateFormat dateFormat = new SimpleDateFormat(format); return dateFormat.format(date); } }