List of utility methods to do Timestamp Format
String | getTimestampFormat(long time) get Timestamp Format try { return timestamp.format(new Date(time)); } catch (Exception e) { return "cant figure out (" + time + ")"; |
String | sortedTimestampFormat(Date date) sorted Timestamp Format return getSortedTimetampFormat().format(date);
|
int | stringConvertToTimestamp(String value, String format) string Convert To Timestamp SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format); Date date = null; try { date = simpleDateFormat.parse(value); } catch (ParseException e) { return (int) (date.getTime() / 1000); |
String | TimeStamp2Date(long timestampString, String formats) Time Stamp Date Long timestamp = timestampString; String date = new SimpleDateFormat(formats).format(new Date(timestamp)); return date; |
String | timeStamp2Date(String seconds, String format) time Stamp Date if (seconds == null || seconds.isEmpty() || seconds.equals("null")) { return ""; if (format == null || format.isEmpty()) format = "yyyy-MM-dd HH:mm:ss"; SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(new Date(Long.valueOf(seconds))); |
String | Timestamp2DDMMYYYY(java.sql.Timestamp ts) Timestamp DDMMYYYY if (ts == null) { return ""; } else { java.util.Calendar calendar = java.util.Calendar.getInstance(); calendar.setTime(new java.util.Date(ts.getTime())); String strTemp = Integer.toString(calendar.get(calendar.DAY_OF_MONTH)); if (calendar.get(calendar.DAY_OF_MONTH) < 10) { strTemp = "0" + strTemp; ... |
String | Timestamp2HHMMSS(java.sql.Timestamp ts, int iStyle) Timestamp HHMMSS if (ts == null) { return ""; java.util.Calendar calendar = java.util.Calendar.getInstance(); calendar.setTime(new java.util.Date(ts.getTime())); String strTemp; if (iStyle == 0) { strTemp = Integer.toString(calendar.get(calendar.HOUR_OF_DAY)); ... |
String | timestamp2String(long source, DateFormat format) timestamp String return date2String(timestamp2Date(source), format);
|
String | Timestamp2UTC(Timestamp mytime) Converts a java.util.Timestamp to UTC needed if the "Generalized Time Syntax Plug-in" of FedoraDS is not enabled Timestamp b = new Timestamp(mytime.getTime()); SimpleDateFormat mySimpleFormat = new SimpleDateFormat("yyyyMMddHHmmss"); mySimpleFormat.setTimeZone(TimeZone.getTimeZone("UTC")); String ret = mySimpleFormat.format(b) + "Z"; return ret; |
String | timestampConvertToString(int timeStamp, String format) timestamp Convert To String SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format); long lTime = Long.valueOf(timeStamp); return simpleDateFormat.format(new Date(lTime * 1000)); |