import java.text.SimpleDateFormat; import java.util.Date; /** Test SimpleDateFormat * * @author scott */ public class TestDateFormat { static SimpleDateFormat df = new SimpleDateFormat ("H':'m':'s"); public static void attempt (String s) { try { System.out.println ("Parsing \"" + s + "\""); Date result = df.parse (s); System.out.println (" - Result = " + result); } catch (Throwable t) { t.printStackTrace (); } } public static void main (String[] args) { attempt ("2:03:34"); attempt ("2: 3:34"); } }