String str = "2018-08-01"; DateFormat fmt =new SimpleDateFormat("yyyy-MM-dd"); Date date = fmt.parse(str);