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

StringgetHourFormat(String string)
get Hour Format
try {
    return sdf_hour.format(sdf_hour.parse(string));
} catch (ParseException e) {
    return null;
SimpleDateFormatgetHourMinuteFormatter()
get Hour Minute Formatter
return hmformatter;
NumberFormatgetHoursNumberFormat()
get Hours Number Format
return getHoursNumberFormat(Locale.getDefault());
StringgetOnehouragoFormatString(String format)
get Onehourago Format String
SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.UK);
Date date = new Date();
date.setTime(date.getTime() - (1 * 1000 * 60 * 60));
return formatter.format(date);
inthoursBetween(String from, String to, String format)
hours Between
SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.UK);
Calendar calendar = Calendar.getInstance(Locale.UK);
calendar.setFirstDayOfWeek(Calendar.MONDAY);
calendar.setMinimalDaysInFirstWeek(4);
Date date1 = null;
Date date2 = null;
try {
    date1 = formatter.parse(from);
...
StringhoursFrom(Date date, int amount, String format)
hours From
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(hoursFrom(date, amount));