System.out.println(time); //Sun Oct 22 00:00:00 GMT+08:00 2017
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy",Locale.US);
TimeZone tz = TimeZone.getTimeZone("GMT+8");
sdf.setTimeZone(tz);
Date s = null;
String da = null;
Date strToDate = null;
try {
s = sdf.parse(time);
System.out.println(s); // Sun Oct 22 00:00:00 CST 2017
sdf = new SimpleDateFormat("yyyy-MM-dd");
da = sdf.format(s);
System.out.println(da); // 2017-10-22
strToDate = sdf.parse(da);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}