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

DateFormatcreateFormatter()
This creates a date formatter for yyyy-MM-dd'T'HH:mm:ss'Z' which is has to be identical to buildDate used in pom.xml
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
df.setTimeZone(TimeZone.getTimeZone("UTC"));
return df;
DateFormatcreateFormatter(String str)
Creates a SimpleDateFormat with the UK locale.
DateFormat df = new SimpleDateFormat(str, Locale.UK);
df.setTimeZone(UTC);
return df;
DateFormatcreateSimpleFormat()
create Simple Format
return new SimpleDateFormat(SIMPLE_DATE_FORMAT);
ThreadLocalcreateThreadLocal(final String format)
create Thread Local
return new ThreadLocal<SimpleDateFormat>() {
    protected SimpleDateFormat initialValue() {
        return new SimpleDateFormat(format);
    ;
};
SimpleDateFormatget8charDateFormat()
getchar Date Format
return new SimpleDateFormat(format8chars);
SimpleDateFormatgetCommandFormat()
A method that returns the date string for the calling command
return COMMAND;
StringgetDataAtual(String formato)
Retorna a data atual no formato informado.
SimpleDateFormat fm = new SimpleDateFormat(formato);
String data = null;
try {
    data = fm.format(new Date());
} catch (Exception e) {
    System.out.println(e.getMessage());
return data;
...
DateFormatgetDataFormatter()
Get a Date formatter for the common API date format
return simpleDateFormat;
SimpleDateFormatgetDBFormat()
Returns instance of a SimpleDateFormat where the format has been set to yyyy-MM-dd hh:mm:ss.SSS
SimpleDateFormat format = new SimpleDateFormat("yyyy'-'MM'-'dd HH:mm:ss.SSS");
format.setLenient(false);
return format;
DateFormatgetExcelFormat()
get Excel Format
if (xldf == null) {
    xldf = new SimpleDateFormat();
xldf.applyPattern("yyyy-MM-dd HH:mm:ss");
return xldf;