3

The input date is Tue Jun 09 07:00:00 SAST 2015. I want to parse this to a date so I used

SimpleDateFormat inputFormatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH);

Date inputDate = inputFormatter.parse("Tue Jun 09 07:00:00 SAST 2015");

This throws a ParseException at offset 20

Murtaza Khursheed Hussain
  • 15,176
  • 7
  • 58
  • 83
blaffie
  • 505
  • 1
  • 10
  • 32
  • It's working for me as-is, I got `inputDate :: Tue Jun 09 10:30:00 IST 2015` . – TheCodingFrog Jun 09 '15 at 13:26
  • Maybe it will only receive time zone IDs in this list: https://garygregory.wordpress.com/2013/06/18/what-are-the-java-timezone-ids/ – selalerer Jun 09 '15 at 13:31
  • See this answer too: http://stackoverflow.com/a/5937103/481528 – selalerer Jun 09 '15 at 13:34
  • Check if the timezone "Africa/Johannesburg" is supported on your Android device. You can use this code: `System.out.println(TimeZone.getTimeZone("Africa/Johannesburg").getDisplayName(false, TimeZone.SHORT)); // SAST ` Or inspect `TimeZone.getAvailableIDs()` – Meno Hochschild Jun 09 '15 at 13:42

0 Answers0