@Test public void testParseTimeString() { long ts = HelperUtils.parseTimeString("2013-12-12 12:12"); DateTime dt = new DateTime(2013, 12, 12, 12, 12); assertEquals(dt.getMillis(), ts); ts = HelperUtils.parseTimeString(" 2013-12-12 12:12 "); assertEquals(dt.getMillis(), ts); ts = HelperUtils.parseTimeString("12:12:12 12:12"); assertEquals(-1L, ts); ts = HelperUtils.parseTimeString("2013-12-12 12:12"); assertEquals(-1L, ts); ts = HelperUtils.parseTimeString("2x, 2h"); assertEquals(-1L, ts); }
public static Long parseTimeString(String input) { if (input.equals("0") || input.equals("unlimited")) { return 0L; } if (!hasCorrectFormat(input)) { return -1L; } input = input.trim(); DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm"); return formatter.parseDateTime(input).getMillis(); }
HelperUtils { public static Long parseTimeString(String input) { if (input.equals("0") || input.equals("unlimited")) { return 0L; } if (!hasCorrectFormat(input)) { return -1L; } input = input.trim(); DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm"); return formatter.parseDateTime(input).getMillis(); } }
HelperUtils { public static Long parseTimeString(String input) { if (input.equals("0") || input.equals("unlimited")) { return 0L; } if (!hasCorrectFormat(input)) { return -1L; } input = input.trim(); DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm"); return formatter.parseDateTime(input).getMillis(); } private  HelperUtils(); }
HelperUtils { public static Long parseTimeString(String input) { if (input.equals("0") || input.equals("unlimited")) { return 0L; } if (!hasCorrectFormat(input)) { return -1L; } input = input.trim(); DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm"); return formatter.parseDateTime(input).getMillis(); } private  HelperUtils(); static Long parseTimeString(String input); static String parseStringTs(long ts_Active); static String addZero(int no); static boolean hasCorrectFormat(String input); static void parseEntryValue(Context context, Integer defaultNo); static List<String[]> getLanguageList(String[] availableLanguages, Context context, Result result,
                                                 Messages msg); static boolean checkEmailAddressValidness(String[] mailAddressParts, String[] domainList); static String[] splitMailAddress(String mailAddress); static String getHeaderText(final MimeMessage message); static byte[] readLimitedAmount(InputStream data, int maxSize); }
HelperUtils { public static Long parseTimeString(String input) { if (input.equals("0") || input.equals("unlimited")) { return 0L; } if (!hasCorrectFormat(input)) { return -1L; } input = input.trim(); DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm"); return formatter.parseDateTime(input).getMillis(); } private  HelperUtils(); static Long parseTimeString(String input); static String parseStringTs(long ts_Active); static String addZero(int no); static boolean hasCorrectFormat(String input); static void parseEntryValue(Context context, Integer defaultNo); static List<String[]> getLanguageList(String[] availableLanguages, Context context, Result result,
                                                 Messages msg); static boolean checkEmailAddressValidness(String[] mailAddressParts, String[] domainList); static String[] splitMailAddress(String mailAddress); static String getHeaderText(final MimeMessage message); static byte[] readLimitedAmount(InputStream data, int maxSize);  }