Question: I have a hashmap:
Map dateEvent = new HashMap(); where key is a date and time and value is a string.
I fill collection with data where date is in format dd.MM.yyyy HH:mm.
How I can get all keys with date based on this format: dd.MM.yyyy?

Answer: 
This code will do the trick:

```
public static void findEvents(Map<Date, Event> dateEvents, Date targetDate) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
    String target = dateFormat.format(targetDate); 
    for (Map.Entry<Date, Event> entry : dateEvents.entrySet()) {
        if (dateFormat.format(entry.getKey()).equals(target)) {
            System.out.println("Event " + entry.getValue() + " is on the specified date");
        }
    }
}

```

The important thing here is that all dates are converted to a String with format "dd.MM.yyyy" before comparing, so any differences in hour/minute/second still match if the day is the same.

This code also demonstrates the best way (IMHO) to iterate over a map.
Not sure whether I get you right. However, you get the set of keys from a map using `map.keySet()`. If you want to find all different dates fill all dates into a set. If you want to reduce the accuracy to days, one solution would be to convert the date to the desired format and add those strings to a set. Duplicates will be removed automatically. 

E.g.: 

```
Map<Date, String> yourMap = [..];

SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd.MM.yyyy");

Set<String> differentDates = new HashSet<String>();
for (Date date: yourMap.keySet()) {
    differentDates.add(simpleDateFormat.format(date));
}

```