It's to remove ambiguity (not all), i.e. you select a date and then specify how you want it to look. For example, the date 12/05/2017 can be interpreted as either DD/MM/YYYY or MM/DD/YYYY but if you select a date first and then describe your desired format we can exclude one of the possibilities.
Perhaps consider removing the choice? For example, have only one input (the desired format) and above it some text saying "How would you format '28/03/2018 21:37'?".
This removes the confusion of two inputs, and provided you select an unambiguous baseline date (day & hour > 12) it should be more clear.