fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.text.*;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. String test = "lun 19 de Sept de 2014";
  14. try {
  15.  
  16. SimpleDateFormat a = new SimpleDateFormat("EEE d 'de' MMMM 'de' yyyy", new Locale("es","ES"));
  17. System.out.println(a.parse(test));
  18. } catch (ParseException e) {
  19. e.printStackTrace();
  20. int index = e.getErrorOffset();
  21. System.out.println("offset: " + index + "(" + test.charAt(index) + ")");
  22. }
  23. }
  24. }
Success #stdin #stdout #stderr 0.11s 381888KB
stdin
Standard input is empty
stdout
offset: 13(t)
stderr
java.text.ParseException: Unparseable date: "lun 19 de Sept de 2014"
	at java.text.DateFormat.parse(DateFormat.java:357)
	at Ideone.main(Main.java:17)