List of utility methods to do Timestamp Format
String | timeStampForFileName(final String simpleDateFormat) time Stamp For File Name Date currentDateTime = new Date(System.currentTimeMillis()); SimpleDateFormat humanReadableFormat = new SimpleDateFormat(simpleDateFormat); return humanReadableFormat.format(currentDateTime); |
String | timestampFormat(Date date) timestamp Format return getTimetampFormat().format(date);
|
String | timestampFormat(final Date date) timestamp Format if (date == null) { return ""; return getTimestampFormat().format(date); |
Date | timeStampFormat(Timestamp t) time Stamp Format DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); dateFormat.format(t); Date d = null; try { d = dateFormat.parse(dateFormat.format(t)); } catch (ParseException e) { e.printStackTrace(); return d; |
String | timestampToFormattedDate(Long timestamp) timestamp To Formatted Date if (timestamp == null) { return null; return DATE_FORMAT.format(new Date(timestamp)); |
String | timestampToString(final Date ts, final String format, final String tzId) timestamp To String Date ret = ts; SimpleDateFormat formatter = new SimpleDateFormat(format); formatter.setTimeZone(TimeZone.getTimeZone(tzId)); if (ret == null) { ret = new Date(); return formatter.format(ret); |
String | timestampToString(Long timestamp, String formatStr) timestamp To String if (timestamp == null) { return null; SimpleDateFormat sdf = new SimpleDateFormat(formatStr); try { return sdf.format(timestamp); } catch (Exception e) { e.printStackTrace(); ... |
String | timeToString(long timestamp, SimpleDateFormat format) time To String return format.format(new Date(timestamp)); |
String | toDateFromTimestamp(String timestamp, String format) to Date From Timestamp DateFormat f = new SimpleDateFormat(format); Date dateObj = new Date(Long.parseLong(timestamp)); return f.format(dateObj); |
String | toHumanTime(long timestamp, String format) Returns a string representation of the timestamp using the specified format. return (format == null) ? defaultSDF.format(timestamp) : new SimpleDateFormat(format).format(timestamp); |