Java Utililty Methods Hour Format

List of utility methods to do Hour Format

Description

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

Method

Stringformat_default(Date time)
formadefault
return FORMATER_3.format(time);
StringformatAbsoluteTime(long time)
format Absolute Time
return formatAbsoluteTime(new Date(time));
StringformatAddTime(Date addTime)
format Add Time
Calendar calendar = Calendar.getInstance();
int curYear = calendar.get(Calendar.YEAR);
int curMonth = calendar.get(Calendar.MONTH);
int curDay = calendar.get(Calendar.DATE);
calendar.setTime(addTime);
int addYear = calendar.get(Calendar.YEAR);
int addMonth = calendar.get(Calendar.MONTH);
int addDay = calendar.get(Calendar.DATE);
...
StringformatAllDate(Date date)
format All Date
return format(date, defaultDatePattern1);
StringformatAsCassandraDateTime(Date date)
Formats as a date time string till mins
SimpleDateFormat parser = new SimpleDateFormat();
parser.setLenient(false);
parser.applyPattern(ISO8601_DATETIME_ZONE);
return parser.format(date);
StringformatAsDateAndTime(Date date)
format As Date And Time
if (date != null) {
    return sdfDateAndTime.format(date);
return null;
StringformatAsHour(long l)
format As Hour
return dfHour.format(new Date(l * 60 * 1000));
StringformatAsRoundTripDate(Date date)
Formats the given date as round-trip date string
SimpleDateFormat roundTripDateFormat = new SimpleDateFormat(ROUND_TRIP_DATE_FORMAT);
return roundTripDateFormat.format(date);
StringformatAsXsdDateTime(Date date)
Returns a date formatted according to the xsd:dateTime data type
XSD_DATE_TIME_FORMAT.setTimeZone(TimeZone.getDefault());
StringBuffer buffer = new StringBuffer(XSD_DATE_TIME_FORMAT.format(date));
buffer.insert(buffer.length() - 2, ':');
return buffer.toString();
StringformatCalendarForXpath(Calendar date)
format Calendar For Xpath
return "xs:dateTime('" + getXpathFormattedDate(date.getTime()) + 'T' + getXpathFormattedTime(date.getTime())
        + getTimeZone(date.getTime()) + "')";