List of utility methods to do Millisecond Format
String | reverseFormattedDateWithMilliseconds() reverse Formatted Date With Milliseconds Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, 1); SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS"); String formatted = format.format(cal.getTime()); assert (formatted != null); return formatted; |
long | stringToTimestampInMilliseconds(String s, DateFormat formatter) Convert a date time string (e.g., "2011-06-07 19:12:18") to a timestamp in milliseconds (i.e., the number of milliseconds since January 1, 1970, 00:00:00 GMT. Date d = stringToDate(s, formatter);
return d == null ? 0 : d.getTime();
|
long | strToDateMillisTimestamp(String dateStr, String formatStr) str To Date Millis Timestamp Date date = strToDate(dateStr, formatStr);
return date != null ? date.getTime() : 0;
|
String | timeFormat(final long milliseconds) Converts into seconds and returns a string in the format double seconds = milliseconds / 1000.0d; final NumberFormat fmt = new DecimalFormat("#0.000"); return fmt.format(seconds); |
String | timeMillisToString(long timeMillis, String dateFormat) time Millis To String if ("".equals(dateFormat) || dateFormat == null) { return null; try { return new SimpleDateFormat(dateFormat).format(new Date(timeMillis)); } catch (Exception e) { return null; |