List of utility methods to do Time Parse
boolean | isRFC3339Date(String date) is RFC Date boolean ret = false; try { if (date != null && date.length() > 0) { Time t = new Time(); t.parse3339(date); ret = true; } catch (TimeFormatException tfex) { ... |
long | parseTime(String time) parse Time return parse(TIME_FORMAT, time);
|
long | parseTimeString(final String time) Takes a string of the form [HH:]MM:SS[.mmm] and converts it to milliseconds. String[] parts = time.split(":"); long result = 0; int idx = 0; if (parts.length == 3) { result += Integer.valueOf(parts[idx]) * 3600000L; idx++; result += Integer.valueOf(parts[idx]) * 60000L; ... |
String | str2Time(String str) str Time SimpleDateFormat sdf = new SimpleDateFormat( "EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); Date date = null; try { date = (Date) sdf.parse(str); } catch (ParseException e) { e.printStackTrace(); String formatStr = new SimpleDateFormat("HH:mm").format(date); return formatStr; |
long | str2TimeMillis(String str) str Time Millis SimpleDateFormat sdf = new SimpleDateFormat( "EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); Date date = null; try { date = (Date) sdf.parse(str); } catch (ParseException e) { e.printStackTrace(); return date.getTime(); |
void | time(String tag) time times.put(tag, System.currentTimeMillis()); |
Date | toModifiedTimeDate(double modDouble) to Modified Time Date try { long mod = Math.round(modDouble * 1000); return new Date(mod); } catch (Exception e) { return null; |
Date | toModifiedTimeDate(String modified) to Modified Time Date @SuppressWarnings("unused") long now = System.currentTimeMillis(); try { double modDouble = Double.parseDouble(modified) * 1000; long mod = Math.round(modDouble); return new Date(mod); } catch (Exception e) { return new Date(); ... |
String | toStandardTime(String compactTime) to Standard Time if (compactTime.trim().length() < 14) { return ""; } else { return String.format("%s-%s-%s %s:%s:%s", compactTime.substring(0, 4), compactTime.substring(4, 6), compactTime.substring(6, 8), compactTime.substring(8, 10), ... |