Please note this, If i am giving dateTime UTC "2017-07-13T05:43:24.6966215Z"
it gives me back in IST Thu Jul 13 07:39:30 IST 2017
instead of Thu Jul 13 11:13:25 IST 2017
String rawDate = "2017-07-13T05:43:24.6966215Z";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'");
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("IST"));
Date date = simpleDateFormat.parse(rawDate);
System.out.println(date);
So after gone through this answer i came to know this given string is not Date format rather than ISO Instant format.
Milliseconds (SSS) can only be three digits. On more than that, the date rolls over - e.g. 10:38:14.1000 becomes 10:38:15.000.
To convert Instant to Date Object
String rawDate = "2017-07-13T05:43:24.6966215Z";
DateTimeFormatter instantFormater = DateTimeFormatter.ISO_INSTANT.withZone(ZoneId.of("Asia/Kolkata"));
Instant instant = Instant.from(instantFormater.parse(rawDate));
System.out.println(Date.from(instant));
It gives expected Thu Jul 13 11:13:24 IST 2017
Check this answer