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

StringformatDateTimeForSolr(Date d)
format Date Time For Solr
return formatDateTime(d, DATETIME_PATTERN_SOLR);
StringformatDateTimeFull(Date dateTime)
format Date Time Full
if (dateTime == null) {
    return NOT_DEFINED_DATE;
return fullDateTimeDF.format(dateTime);
StringformatDateTimeStringForEquivalentCommand(final Date date)
Formats a Date to String representation in "dd/MMM/yyyy:HH:mm:ss Z".
if (date != null) {
    final SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_LOCAL_TIME);
    dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
    return dateFormat.format(date);
return null;
DateformatDateToEndDateTime(String strDate)
format Date To End Date Time
java.util.Date date = null;
try {
    date = convertStringToDate(LONG_DATE_TIME_PATTERN, strDate + " 23:59:59");
} catch (ParseException e) {
    e.printStackTrace();
return date;
StringformatDateToHMSString(java.util.Date date)
format Date To HMS String
if (date == null) {
    return "";
java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat("HH:mm:ss");
return dateFormat.format(date);
StringformatDateToHours(Date time)
format Date To Hours
SimpleDateFormat formatter;
formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String ctime = formatter.format(time);
return ctime;
StringformatDateToStr(String format, Date date)
format Date To Str
String dateStr = null;
if (yyyyMMdd.equals(format)) {
    dateStr = dateFormat.format(date);
} else if (yyyy_MM_dd.equals(format)) {
    dateStr = dateFormat2.format(date);
} else if (ddMMyy.equals(format)) {
    dateStr = dateFormat3.format(date);
} else if (yyyyMM.equals(format)) {
...
StringformatDateToString(java.util.Date date, int format)
Do format date with specified type.
String rel = null;
if (date != null) {
    if (format >= DATE_FORMATTER.length || format < 0) {
        format = 0;
    rel = DATE_FORMATTER[format].format(date);
return rel;
...
StringformatDebugMessage(String debugLevel, Object msg)
Format our debug message with a timestamp and debug level
String timeStamp = new SimpleDateFormat("yyyy/MM/dd HH-mm-ss").format(new Date());
return "[" + debugLevel + "] [" + timeStamp + "] " + msg.toString();
StringformatDicomTime(String dicomTime)
Format a DICOM time (HHMMSS.sssss) to a more human readable form.
if (dicomTime == null) {
    return dicomTime;
dicomTime = dicomTime.trim();
if (dicomTime.indexOf('.') != -1) {
    dicomTime = dicomTime.replaceAll("\\..*", "");
Date date = null;
...