Java Utililty Methods Date to Time

List of utility methods to do Date to Time

Description

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

Method

StringtoTimeString(Date date)
to Time String
if (date == null) {
    return null;
SimpleDateFormat sdff = new SimpleDateFormat("HH:mm:ss");
String dateStr = sdff.format(getNowDateTime());
return dateStr;
StringtoTimeString(Date date)
to Time String
if (date == null) {
    return "";
return new SimpleDateFormat(Format_Time).format(date);
StringtoTimeString(Date dateTime)
to Time String
DateFormat dateFormat = DateFormat.getDateTimeInstance();
return dateTime != null ? dateFormat.format(dateTime) : "";
StringtoTimeString(Date time)
Formats the date instance into a string keeping only the time of the day and excluding the remaining info.
return toDateString(time, DEFAULT_TIME_PATTERN);
StringtoUIDateTimeString(Date d)
Returns the specified date formatted for the UI
return createCurrTz().format(d);
StringtoXSDDateTime(Date date)
to XSD Date Time
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
String s = simpleDateFormat.format(date);
StringBuilder sb = new StringBuilder(s);
sb.insert(22, ':');
return sb.toString();
StringtoXSDDateTimeString(Date d)
Formats a Date into XSD dateTime format
return createZulu().format(d);