Here you can find the source of formatDate(java.util.Date date, String formatPattern)
Parameter | Description |
---|---|
date | The date going to be formatted. |
formatPattern | The format pattern. |
public static String formatDate(java.util.Date date, String formatPattern)
//package com.java2s; /*//from w w w. ja v a 2 s . c om * @(#)TextUtility.java * * Copyright (c) 2003 DCIVision Ltd * All rights reserved. * * This software is the confidential and proprietary information of DCIVision * Ltd ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the license * agreement you entered into with DCIVision Ltd. */ public class Main { /** * formatDate * * Returns the formatted date according to the input pattern. * * @param date The date going to be formatted. * @param formatPattern The format pattern. * @return The formatted date according to the input pattern. */ public static String formatDate(java.util.Date date, String formatPattern) { if (date == null) { return ""; } java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat(formatPattern, new java.util.Locale("en", "US")); return (formatter.format(date)); } }