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

StringformatDateTime(Date date)
format Date Time
if (dateTimeFormat == null) {
    dateTimeFormat = new SimpleDateFormat(DATETIME_FORMAT);
return dateTimeFormat.format(date);
StringformatDateTime(Date date)
format Date Time
if (date == null)
    return null;
SimpleDateFormat sdf = new SimpleDateFormat(FORMAT_DATETIME);
sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
return sdf.format(date);
StringformatDateTime(Date date)
Formats a Date object to an ISO8601 date/time string.
if (date == null) {
    return formatDateTime(new Date());
String dateStr = m_ISO8601DateTime.format(date);
return dateStr;
StringformatDateTime(Date date)
format Date Time
SimpleDateFormat sdf = new SimpleDateFormat(dateTimePatter);
sdf.setTimeZone(TimeZone.getTimeZone(timeZoneCode));
sdf.setLenient(false);
return sdf.format(date);
StringformatDateTime(Date date)
format Date Time
return formatDate(date, DEFAULT_DATETIME_PATTERN);
StringformatDateTime(Date dateTime)
format Date Time
return dateTimeSdf.format(dateTime);
StringformatDateTime(Date myDate)
format Date Time
return formatDateTime(myDate, patternDateTime);
StringformatDateTime(final Calendar cal)
format Date Time
if (cal == null) {
    throw new NullPointerException("cal");
DateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
return formatter.format(cal.getTime());
StringformatDateTime(final Date dat)
Format Date accoring to Patter of 'YYYY-MM-DD 24H:mm' and Locale of US
return formatDate(dat, "yyyy-MM-dd HH:mm", Locale.US);
StringformatDateTime(final Date date)
Format the Date using pattern "yyyy-MM-dd HH:mm:ss"
return formatDateTime(date, null);