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
  • 155,977
  • 14
  • 207
  • 269
nizam.sp
  • 3,892
  • 5
  • 37
  • 60

2 Answers2

4

Z has no colon separator. You could do

SimpleDateFormat format = new SimpleDateFormat("dd MMM yyyy HH:mmX");
Reimeus
  • 155,977
  • 14
  • 207
  • 269
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
  • 84,451
  • 9
  • 82
  • 121