@Test public void testStr2LongWithHour() { String time = "1h"; assertEquals(String.valueOf(TimeUtil.str2Long(time)), "3600000"); }
public static Long str2Long(String timeStr) { if (timeStr == null) { LOGGER.warn("Time string can not be empty."); return 0L; } String trimTimeStr = timeStr.trim(); boolean positive = true; if (trimTimeStr.startsWith("-")) { trimTimeStr = trimTimeStr.substring(1); positive = false; } List<TimeUnitPair> list = getTimeUnitPairs(trimTimeStr); return str2Long(positive, list); }
TimeUtil { public static Long str2Long(String timeStr) { if (timeStr == null) { LOGGER.warn("Time string can not be empty."); return 0L; } String trimTimeStr = timeStr.trim(); boolean positive = true; if (trimTimeStr.startsWith("-")) { trimTimeStr = trimTimeStr.substring(1); positive = false; } List<TimeUnitPair> list = getTimeUnitPairs(trimTimeStr); return str2Long(positive, list); } }
TimeUtil { public static Long str2Long(String timeStr) { if (timeStr == null) { LOGGER.warn("Time string can not be empty."); return 0L; } String trimTimeStr = timeStr.trim(); boolean positive = true; if (trimTimeStr.startsWith("-")) { trimTimeStr = trimTimeStr.substring(1); positive = false; } List<TimeUnitPair> list = getTimeUnitPairs(trimTimeStr); return str2Long(positive, list); }  }
TimeUtil { public static Long str2Long(String timeStr) { if (timeStr == null) { LOGGER.warn("Time string can not be empty."); return 0L; } String trimTimeStr = timeStr.trim(); boolean positive = true; if (trimTimeStr.startsWith("-")) { trimTimeStr = trimTimeStr.substring(1); positive = false; } List<TimeUnitPair> list = getTimeUnitPairs(trimTimeStr); return str2Long(positive, list); }  static Long str2Long(String timeStr); static String format(String timeFormat, long time, TimeZone timeZone); static TimeZone getTimeZone(String timezone); }
TimeUtil { public static Long str2Long(String timeStr) { if (timeStr == null) { LOGGER.warn("Time string can not be empty."); return 0L; } String trimTimeStr = timeStr.trim(); boolean positive = true; if (trimTimeStr.startsWith("-")) { trimTimeStr = trimTimeStr.substring(1); positive = false; } List<TimeUnitPair> list = getTimeUnitPairs(trimTimeStr); return str2Long(positive, list); }  static Long str2Long(String timeStr); static String format(String timeFormat, long time, TimeZone timeZone); static TimeZone getTimeZone(String timezone);  }