List of utility methods to do Date Format Pattern
String | getFormattedValue(Object customFieldValue) Get a formatted value as pattern "dd/MMM/yy" if the value is instance of Date String cfValue = ""; if (customFieldValue instanceof Date) { SimpleDateFormat sdf = new SimpleDateFormat("dd/MMM/yy"); Date date = (Date) customFieldValue; cfValue = sdf.format(date).toString(); } else { cfValue = customFieldValue.toString(); return cfValue; |
DateFormat | getFormatter() get Formatter return formatter;
|
DateFormat | getFormatter() Retrieves the DateFormat for the current Thread DateFormat formatter = FORMATTER.get(); if (formatter == null) { formatter = createIsoDateFormatter(); FORMATTER.set(formatter); return formatter; |
ThreadLocal | getFormatter(final String pattern) get Formatter if (!formatters.containsKey(pattern)) { formatters.put(pattern, new ThreadLocal<SimpleDateFormat>() { @Override protected SimpleDateFormat initialValue() { return new SimpleDateFormat(pattern); }); return formatters.get(pattern); |
SimpleDateFormat | getFormatter(String pattern) get Formatter SimpleDateFormat sdf = null; if (formatters.containsKey(pattern)) { sdf = formatters.get(pattern); } else { sdf = new SimpleDateFormat(pattern); formatters.put(pattern, sdf); return sdf; ... |
SimpleDateFormat[] | getFormatters() _more_ if (sdfs == null) { SimpleDateFormat[] tmp = new SimpleDateFormat[formats.length]; for (int i = 0; i < formats.length; i++) { tmp[i] = new SimpleDateFormat(formats[i]); sdfs = tmp; return sdfs; ... |
SimpleDateFormat | getFormatToSecsForFilename() Returns a date format to the resolution of seconds, for use in filenames: return new SimpleDateFormat(FORMAT_TO_SECS_FOR_FILE); |
DateFormat | getHeaderFormat() get Header Format DateFormat format = headerFormat.get(); if (format == null) { format = new SimpleDateFormat(HEADER_FORMAT, Locale.ENGLISH); format.setTimeZone(TimeZone.getTimeZone("UTC")); headerFormat.set(format); return format; |
SimpleDateFormat | getLenientFormat(String format) Return a simple date formatter that is lenient. SimpleDateFormat tformatter = new SimpleDateFormat(format); tformatter.setLenient(false); return tformatter; |
String | getMM() get MM SimpleDateFormat formatterMM = new SimpleDateFormat("MM"); return formatterMM.format(Calendar.getInstance().getTime()); |