Here you can find the source of parseDateToString(Date date, String pattern)
Parameter | Description |
---|---|
date | the Date to be parsed. |
pattern | the pattern of the date. |
public static String parseDateToString(Date date, String pattern)
//package com.java2s; /*L// www .j a v a 2s .c o m * Copyright Washington University in St. Louis, SemanticBits, Persistent Systems, Krishagni. * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/wustl-common-package/LICENSE.txt for details. */ import java.text.SimpleDateFormat; import java.util.Date; public class Main { /** * Parses the Date in given format and returns the string representation. * @param date the Date to be parsed. * @param pattern the pattern of the date. * @return */ public static String parseDateToString(Date date, String pattern) { String d = ""; //TODO Check for null if (date != null) { SimpleDateFormat dateFormat = new SimpleDateFormat(pattern); d = dateFormat.format(date); } return d; } }