[ sale83 @ 15.04.2007. 10:49 ] @
Jel moze neko ovo da testira.... Code: import java.text.*; /* *Test - SimpleDateFormat ??? *Aleksandar - sale83 * */ public class test { public static void main(String args[]) { String time="10:10:00 AMBUG"; // BUG TRUE - Vraca TRUE , Navodno da je TIME ispravan WTF lol ?? System.out.println(ValidateTime(time)); // BUG TRUE - Vraca TRUE , Navodno da je DATE ispravan WTF lol ?? String date="04-Nov-2006BUG"; System.out.println(ValidateDate(date)); } public static boolean ValidateTime(String value){ boolean ok = true; try { new SimpleDateFormat("hh:mm:ss a").parse(value); ok = true; } catch (ParseException e) { System.out.println(e.getMessage()); ok = false; } return ok ; } public static boolean ValidateDate(String value){ boolean ok = true; try { new SimpleDateFormat("dd-MMM-yyyy").parse(value); ok = true; } catch (ParseException e) { System.out.println(e.getMessage()); ok = false; } return ok ; } } Meni uvek vraca da je date i time true.... Ocigledno da parser neradi dobro posao ili sam ja negde pogresio :) Poz sale |