Java Utililty Methods Date Format Pattern

List of utility methods to do Date Format Pattern

Description

The list of methods to do Date Format Pattern are organized into topic(s).

Method

StringgetMM(Date date)
get MM
return DATE_FORMAT6.format(date);
intgetMM(String strDate)
Insert the method's description here.
Calendar calendar = Calendar.getInstance();
calendar.setTime(convertStringToDate(strDate));
return calendar.get(Calendar.MONTH) + 1;
SimpleDateFormatgetMMdd()
get M Mdd
SimpleDateFormat mmdd = new SimpleDateFormat("MM/dd");
return mmdd;
StringgetMMDDYYHHMM()
get MMDDYYHHMM
return getMMDDYYHHMM(new Date());
StringgetMMDDYYYY(final Date date, final String separator)
Returns the date as month/day/year with the supplied separator.
SimpleDateFormat format = new SimpleDateFormat("MM" + separator + "dd" + separator + "yyyy");
return format.format(date);
SimpleDateFormatgetMomentFormatter()
get Moment Formatter
return m_momentFormat;
SimpleDateFormatgetPooledSDF(String format)

Gets a SimpleDateFormat for the given format.

SimpleDateFormat sdf = null;
Stack stack = (Stack) sdfCache.get(format);
if (stack != null) {
    try {
        sdf = (SimpleDateFormat) stack.pop();
    } catch (EmptyStackException ese) {
if (sdf == null) {
    sdf = new SimpleDateFormat(format);
return sdf;
SimpleDateFormatgetSdf(String formatPattern)
get Sdf
SimpleDateFormat sdf = sdfLocal.get();
if (sdf == null) {
    sdf = new SimpleDateFormat(formatPattern);
    sdfLocal.set(sdf);
return sdf;
FilegetSimpleDataFormattedFile(File file)
This method will be called for create a backup file.
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); 
String date = df.format(new Date());
String filename = file.getName();
int index = filename.lastIndexOf("."); 
if (index != -1)
    filename = filename.substring(0, index) + "." + date + "." + filename.substring(index + 1); 
else
    filename = filename + "." + date; 
...
DateFormatgetSortedTimetampFormat()
get Sorted Timetamp Format
return new SimpleDateFormat("yyyyMMddHHmmss");