Here you can find the source of changeDateFormatPattern(final DateFormat dateFormat, String regex, String replacement)
private static DateFormat changeDateFormatPattern(final DateFormat dateFormat, String regex, String replacement)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; public class Main { private static DateFormat changeDateFormatPattern(final DateFormat dateFormat, String regex, String replacement) { if (dateFormat instanceof SimpleDateFormat) { SimpleDateFormat simpleDateFormat = (SimpleDateFormat) dateFormat; String pattern = simpleDateFormat.toPattern().replaceAll(regex, replacement); simpleDateFormat.applyPattern(pattern); return simpleDateFormat; }// www.j a v a2s .co m return dateFormat; } }