Android Utililty Methods Timestamp Format

List of utility methods to do Timestamp Format

Description

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

Method

Stringformat(Timestamp tt, String pattern)
format
if (tt == null) {
    return null;
Date date = new Date(tt.getTime());
return getFormat(pattern).format(date);
StringformatDate(Timestamp value)
format Date
return formatDateTime(value, ISO_DATE_FORMAT);
StringformatDate(Timestamp value, String defaultFormat)
format Date
if (value == null) {
    return "";
String strFormatStyle = StringUtils.isEmpty(defaultFormat) ? ISO_DATE_FORMAT
        : defaultFormat;
SimpleDateFormat objSimpleDateFormat = new SimpleDateFormat(
        strFormatStyle);
return objSimpleDateFormat.format(value);
...
StringformatDateTime(Timestamp value)
format Date Time
return formatDateTime(value, ISO_DATETIME_FORMAT);
StringformatDateTime(Timestamp value, String defaultFormat)
format Date Time
if (value == null) {
    return "";
String strFormatStyle = StringUtils.isEmpty(defaultFormat) ? ISO_DATETIME_FORMAT
        : defaultFormat;
SimpleDateFormat objSimpleDateFormat = new SimpleDateFormat(
        strFormatStyle);
return objSimpleDateFormat.format(value);
...
StringformatShortDate(Timestamp value)
format Short Date
return formatDateTime(value, ISO_SHORT_DATE_FORMAT);
StringformatShortDate(Timestamp value, String defaultFormat)
format Short Date
if (value == null) {
    return "";
String strFormatStyle = StringUtils.isEmpty(defaultFormat) ? ISO_SHORT_DATE_FORMAT
        : defaultFormat;
SimpleDateFormat objSimpleDateFormat = new SimpleDateFormat(
        strFormatStyle);
return objSimpleDateFormat.format(value);
...
StringtimestampToISO8601(Timestamp aTimestamp)
timestamp To ISO
return timestampToISO8601(new Date(aTimestamp.getTime()));
StringtoSloTime(Timestamp time)
to Slo Time
if (time == null)
    return "";
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(time.getTime());
SimpleDateFormat sdf = new SimpleDateFormat("d.M.yyyy H:mm");
return sdf.format(cal.getTime());