I format the string in the date, but the date is still displayed in the format Fri Feb 05 00:00:00 MSK 2016 and I want it in the format yyyy-MM-dd
String s = "2016-02-05"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date m = null; try { m = sdf.parse(s); } catch (ParseException e) { e.printStackTrace(); } _log.info("Дата: " + m); What am I doing wrong?
_log.info("Дата: " + m);? - here you do not specify any format. NB You do not “format” a string into a date, but convert or convert. - Igor_log.info(m.toString(sdf));- Igor