List of utility methods to do Timestamp Format
String | formatDefaultDate(Timestamp time) Formats as a String the specified time, using the default date format: yyyy-MM-dd HH:mm:ss
if (time == null) time = getDefaultTimestamp(); return DEFAULT_DATE_FORMAT.format(time); |
String | formatDuration(final long duration) This is a convenient method for converting duration time/timestamp into a more human readable form. final String format = "mm:ss"; final SimpleDateFormat df = new SimpleDateFormat(format); df.setTimeZone(TimeZone.getTimeZone("UTC")); return df.format(new Date(duration)); |
String | formatElapsed(long elapsed) Format Elapsed Time long miliSeconds = elapsed % 1000; elapsed = elapsed / 1000; long seconds = elapsed % 60; elapsed = elapsed / 60; long minutes = elapsed % 60; elapsed = elapsed / 60; long hours = elapsed % 24; long days = elapsed / 24; ... |
String | formatFileSize(Number data) format File Size if (data == null) { return null; long size = data.longValue(); if (size > TB_SIZE) { DecimalFormat format = new DecimalFormat(PATTERN); return format.format((size * 1.0) / TB_SIZE) + " TB"; } else if (size > GB_SIZE) { ... |
String | formatGMTTimestampToDate(Timestamp time) format GMT Timestamp To Date return toStringFormatGMTTime(time, DEFAULT_DATE_YMD_FORMAT);
|
String | formatJDBCTimeStamp(final java.util.Date date) Obtain an JDBC timestamp string representation of the supplied date. SimpleDateFormat sdf = new SimpleDateFormat(JDBC_TIMESTAMP_FORMAT); sdf.setTimeZone(GMT); return sdf.format(date); |
String | formatJDBCTimeStamp(final java.util.Date date) Obtain an JDBC timestamp string representation of the supplied date. return new SimpleDateFormat(JDBC_TIMESTAMP_FORMAT).format(date); |
String | formatMillis(long _millis) format Millis return new Timestamp(_millis).toString(); |
String | formatShortDateTime(Timestamp time) Formats as a String the specified time.
if (time == null) time = getDefaultTimestamp(); return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.getDefault()).format(time); |
void | formatStatement(PreparedStatement statement, List format Statement for (int i = 0; i < values.size(); ++i) { Object value = values.get(i); int index = i + 1; if (value instanceof String) { statement.setString(index, (String) value); } else if (value instanceof Date) { statement.setTimestamp(index, new Timestamp(((Date) value).getTime())); } else if (value instanceof Boolean) { ... |