2
SimpleDateFormat format = new SimpleDateFormat("dd MMM yyyy HH:mmZ");
date = format.parse("05 Mar 2016 15:37+05:30");

is crashing only on some devices eg: (Galay s3 neo GT-I9300I) with

Non-fatal Exception: java.text.ParseException: Unparseable date:
"05 Mar 2016 15:37+05:30" (at offset 3)

Any help is much appreciated!

Reimeus
  • 158,255
  • 15
  • 216
  • 276
nizam.sp
  • 4,002
  • 5
  • 39
  • 63

2 Answers2

4

Z has no colon separator. You could do

SimpleDateFormat format = new SimpleDateFormat("dd MMM yyyy HH:mmX");
Reimeus
  • 158,255
  • 15
  • 216
  • 276
3

According to the SimpleDateFormat docs, Z/ZZ/ZZZ:-0800 Notice the colon. Your string doesn't have one, so parsing it fails. Yes, its that sensitive.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127