The answer by GriffeyDog and other answers are correct in showing you how to generate a String from a java.util.Date or java.sql.Date object. But…
- The other Answers are using old outmoded classes.
- The other Answers fail to address the critical issue of time zone.
- You may find a better approach in retaining date-time objects rather than storing strings.
java.time
Java 8 and later comes with the java.time framework. These new classes supplant the old java.util.Date/.Calendar and java.text.SimpleTextFormat classes. Those old classes have proven to be confusing, troublesome, and flawed.
From java.sql.Date
If getting a java.sql.Date object from a database (your question is not clear about this), you have date-only value without time-of-day nor time zone. So convert to the java.time.LocalDate class.
LocalDate localDate = myJavaSqlDate.toLocalDate();
From java.util.Date
If getting a java.util.Date object, be aware that is both a date and a time-of-day combined despite the name of the class. Convert to an Instant, a moment on the timeline in UTC.
Instant instant = myJavaUtilDate.toInstant();
Time Zone
From there adjust to a time zone in which you want your date to have a meaning. The date is not the same around the world for any given moment. A new day dawns earlier in the east. So just after midnight in Paris is still ‘yesterday’ in Montréal.
ZoneId zoneId = ZoneId.of( "America/Montreal" );
ZonedDateTime zdt = ZonedDateTime.ofInstant( instant , zoneId );
Now use a DateTimeFormatter to generate a String representation of the date value. The pattern codes are slightly different than those of the old java.text.SimpleDateFormat, so read the class doc carefully.
DateTimeFormatter formatter = DateTimeFormatter.ofPattern( "MM-dd-uuuu" );
String output = zdt.format( formatter );
ISO 8601
If you insist on storing Strings, I suggest changing your format to the standard ISO 8601 format YYYY-MM-DD. Such string values when sorted alphabetically also happen to be chronological. The java.time classes use ISO 8601 formats by default. So no need to specify a coded pattern. Just convert to a LocalDate, then call toString.
String output = zdt.toLocalDate().toString();
Store Date-Time Objects
Better yet, store LocalDate objects as the value in your Map rather than String. Only generate a particular String representation in a particular format when necessary, such as for presentation to a user. Given that LocalDate is now built into Java, you can confidently use it throughout your code knowing it is always available.