I am converting string to date format year and date showing correct but month showing different.
String s = "2018-08-29"
try
{
DateFormat formatter = new SimpleDateFormat("yyyy-MM-DD", Locale.ENGLISH);
Date parse = formatter.parse(s);
long time = parse.getTime();
}catch (ParseException e) {
e.printStackTrace();
}
output: Mon Jan 29 00:00:00 GMT+05:30 2018