List of utility methods to do Timestamp Format
String | format(final Date date) format String milliseconds = new SimpleDateFormat(FORMAT_PATTERN).format(date); if (date instanceof Timestamp) { Timestamp timestamp = (Timestamp) date; final int nanos = timestamp.getNanos(); int microseconds = nanos / 1000; milliseconds = milliseconds.substring(0, milliseconds.indexOf(".") + 1) + String.format("%06d", microseconds); return milliseconds; |
String | format(final long unixTimeStamp) format final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); return sdf.format(new Date(unixTimeStamp * 1000L)); |
String | format(long timestamp) format SimpleDateFormat format = formats.poll(); if (format == null) { format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); format.setTimeZone(TimeZone.getTimeZone("GMT+8")); try { return format.format(new Date(timestamp)); } finally { ... |
String | format(long timeStamp) Formats a numeric timestamp into a textual representation. return FORMAT.format(new Date(timeStamp)); |
Timestamp | format(Timestamp time) format SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String date = sdf.format(time); date = date.substring(0, 10) + " 00:00:00"; time = new Timestamp(sdf.parse(date).getTime()); return time; |
String | format2AdwordsTimestamp(Date date) format Adwords Timestamp Calendar c = Calendar.getInstance(); c.setTime(date); c.add(Calendar.HOUR, -8); return format("yyyyMMdd HHmmss", c.getTime()) + " UTC"; |
String | format8chars(long timestamp) formatchars return format8chars(new Date(timestamp)); |
String | formataDataHoraMinuto(Timestamp dataHora) Formata a Data, a Hora e o Minuto if (dataHora == null) { return ""; SimpleDateFormat formatador = new SimpleDateFormat("dd/MM/yyyy HH:mm"); return formatador.format(dataHora); |
String | formatCalendar(Timestamp stamp) format Calendar SimpleDateFormat format = new SimpleDateFormat("MMM dd yyyy HH:mm:ss", new Locale("en", "US")); return format.format(stamp) + " GMT"; |
String | formatCurrentDateTimeStamp(final String dateFormatString) Supplies Current Date in the given dateFormat. String tmpString = ""; SimpleDateFormat format = new SimpleDateFormat(dateFormatString); tmpString = format.format(new Date()); return tmpString; |