Here you can find the source of formatEn(T date, String pattern)
Parameter | Description |
---|---|
date | a parameter |
public static final <T extends Date> String formatEn(T date, String pattern)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { /**/*from www .ja v a 2s . c o m*/ * @param date * @param pattern: Date format pattern * @return */ public static final <T extends Date> String formatEn(T date, String pattern) { if (date == null) return null; try { SimpleDateFormat df = new SimpleDateFormat(pattern, Locale.ENGLISH); String result = df.format(date); return result; } catch (Exception e) { return null; } } /** * @param date * @param pattern: Date format pattern * @return */ public static final <T extends Date> String format(T date, String pattern) { if (date == null) return null; try { SimpleDateFormat df = new SimpleDateFormat(pattern); String result = df.format(date); return result; } catch (Exception e) { return null; } } }