I am getting a null returned by SimpleDateFormat. But I feel I have done everything correctly.
Below is my code snippet
format = new SimpleDateFormat("yyyy-dd-MM'T'H:mm:ss'Z'", Locale.US);
format.setLenient(true);
ParsePosition pos = new ParsePosition(0);
String timeStr = "2013-10-05T01:21:07Z";
System.out.println(format.format(new Date()));
System.out.println(timeStr);
Date d = format.parse(timeStr,pos);
d.getTime();
Gives the output
2014-30-05T13:43:05Z
2013-10-05T01:21:07Z
Exception in thread "main" java.lang.NullPointerException
I have tried a couple of options mentioned in other posts in this forum. But I am still getting the error. Am I overlooking something trivial?