List of utility methods to do Second Format
int | getSeconds(long time) get Seconds return Integer.valueOf(SECOND_FORMATTER.format(new Date(time))); |
DecimalFormat | getSecondsFormatter() get Seconds Formatter return secondsFormatter.get();
|
int | getSecondsSince(String rfc1123Date) get Seconds Since Date reference = parse(rfc1123Date); Date now = new Date(); return (int) ((now.getTime() - reference.getTime()) / 1000L); |
String | getStringFromNanoSeconds(final long nanoSeconds, final long format) get String From Nano Seconds if (nanoSeconds < 0) { throw new IllegalArgumentException("Nanoseconds must not be less than 0"); String outputString = ""; return outputString; |
String | getThisSecondTime() get This Second Time Calendar calendar = Calendar.getInstance(); Date currentTime = calendar.getTime(); SimpleDateFormat formatter = new SimpleDateFormat("yyMMddHHmmss"); return formatter.format(currentTime); |
Integer | getTimeSecondInteger(Date date) get Time Second Integer try { SimpleDateFormat formater = new SimpleDateFormat("HHmmss"); return Integer.valueOf(formater.format(date)); } catch (Exception e) { return null; |
String | getToSecond() HH:mm:ss SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); Date logonDate = Calendar.getInstance().getTime(); return sdf.format(logonDate); |
long | humanDateToSeconds(String date) human Date To Seconds SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); sdf.setTimeZone(CURRENT_TIME_ZONE); Date d = sdf.parse(date); return d.getTime() / 1000; |
String | parseLongToString(long millsSeconds) parse Long To String SimpleDateFormat df = new SimpleDateFormat(yyyyMMddHH); Date date = new Date(millsSeconds); return df.format(date); |
Date | parseNoSecondFormat(String sDate) yyyy-MM-dd HH:mm DateFormat dateFormat = new SimpleDateFormat(noSecondFormat); if ((sDate == null) || (sDate.length() < noSecondFormat.length())) { throw new ParseException("length too little", 0); return dateFormat.parse(sDate); |