I'm trying to parse below string into date but its showing wrong date
import java.text.SimpleDateFormat;
import java.util.Date;
public class Dateformat {
public static void main(String[] args) throws Exception {
String sDate1 = "2018-10-05T00:00:00-05:00";
Date date1 = new SimpleDateFormat("yyyy-mm-dd").parse(sDate1);
System.out.println(sDate1 + "\t" + date1);
}
}
Doubt: why even its working if pattern is not matching with input string ?
Secondly, why its showing wrong date ?
Output : 2018-10-05T00:00:00-05:00 Fri Jan 05 00:10:00 IST 2018
Suggestions please