Java Utililty Methods Time Format

List of utility methods to do Time Format

Description

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

Method

longgetTimeCount(String from, String to, String format)
get Time Count
Date d1 = dateFormatCheck(from, format);
Date d2 = dateFormatCheck(to, format);
long duration = d2.getTime() - d1.getTime();
return duration;
DateFormatgetTimeFormat()
get Time Format
DateFormat df = new SimpleDateFormat(ISO_8601_DATE_FORMAT);
df.setTimeZone(TimeZone.getTimeZone(TIMEZONE_UTC));
return df;
DateFormatgetTimeFormat()
get Time Format
if (xldf == null) {
    xldf = new SimpleDateFormat();
xldf.applyPattern("HH:mm:ss.SSS");
return xldf;
SimpleDateFormatgetTimeFormat()
get Time Format
return simpleTimeFormatThreadLocal.get();
StringgetTimeFormat(Date date, String strFormat)
Gets the time format.
DateFormat sdf = new SimpleDateFormat(strFormat);
String sDate = sdf.format(date);
return sDate;
StringgetTimeFormat(java.util.Date date)
get Time Format
return getFormat(date, TIME_FORMAT_STR);
StringgetTimeFormat(Locale locale)
Returns appropriate time format string.
if (locale == null) {
    locale = Locale.getDefault();
int timeStyle = -1;
if (TIME_FORMAT == null || "DEFAULT".equals(TIME_FORMAT) || "SHORT".equals(TIME_FORMAT)) {
    timeStyle = DateFormat.SHORT;
} else if ("MEDIUM".equals(TIME_FORMAT)) {
    timeStyle = DateFormat.MEDIUM;
...
SimpleDateFormatgetTimeFormat(String format)
get Time Format
return new SimpleDateFormat(format);
StringgetTimeFormatted()
get Time Formatted
return sdf.format(new Date()) + " - ";
SimpleDateFormatgetTimeFormatter()
get Time Formatter
return new SimpleDateFormat(TIME_FORMAT);