List of utility methods to do Timestamp Format
String | formatDateHour(Date date) format Date Hour SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return sdf.format(date); |
String | formatDateTime(Date date) Format date time. return (formatDate(date, "yyyy-MM-dd HH:mm:ss")); |
String | formatDateTime(java.sql.Timestamp ts) format Date Time String temp = String.valueOf(ts); if (temp != null && temp != "" && temp != "null") temp = temp.substring(0, 16); else if (temp == "null") temp = ""; return temp; |
String | formatDateTime(long ms) Return the time in GMT java.sql.Timestamp t = new java.sql.Timestamp(ms); DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.LONG, Locale.ENGLISH); formatter.setTimeZone(TimeZone.getTimeZone("GMT")); String str = formatter.format(t); return str; |
String | formatDateTime(String dTime) format Date Time String dateTime = ""; if (dTime != null && !"".equals(dTime) && !dTime.startsWith("1900-01-01")) { Timestamp t = Timestamp.valueOf(dTime); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm"); dateTime = formatter.format(t); return dateTime; |
String | formatDateTime(Timestamp t, String pattern) format Date Time return formatDate(new Date(t.getTime()), STANDARD_DATETIME_PATTERN); |
String | formatDateTimeStamp(final Date date) format Date Time Stamp return DATE_TIME_STAMP_FORMAT.format(date);
|
Timestamp | formatDateToTimestamp(String string) yyyy-MM-dd Timestamp result = null; try { Date date = onlyDateFmt.parse(string); result = new Timestamp(date.getTime()); } catch (ParseException e) { e.printStackTrace(); return result; ... |
int | formatDateToUnixTimestamp(Date date) format Date To Unix Timestamp return Long.valueOf(date.getTime() / 1000).intValue();
|
Timestamp | formatDateWithCinderellaTime(Date date) Format a date in the following format 2007-09-27 23:59:00 GregorianCalendar gregorianCalendar = new GregorianCalendar(); gregorianCalendar.setTime(date); gregorianCalendar.set(GregorianCalendar.HOUR_OF_DAY, 23); gregorianCalendar.set(GregorianCalendar.MINUTE, 59); gregorianCalendar.set(GregorianCalendar.SECOND, 0); Date formattedPassoutDate = gregorianCalendar.getTime(); return new Timestamp(formattedPassoutDate.getTime()); |