Here you can find the source of format(String pattern)
Parameter | Description |
---|---|
pattern | a parameter |
public static String format(String pattern)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**// w w w . ja va 2s.co m * Formats given date with specified pattern. * @param pattern * @param date * @return */ public static String format(String pattern, Date date) { return new SimpleDateFormat(pattern).format(date); } /** * Formats actual date with specified pattern. Usage DateHelper.format("HH:mm:ss") * @param pattern * @return */ public static String format(String pattern) { return format(pattern, new Date()); } }