When formatting a date there is multiple diffrent patterns you can use. You can found out more about this by reading the Java docs by Oracle.
Lets start off by saying that the dashes :
don't have anything to do with the actual formatting, and are just added in so it reads nicer.
HH
Using the capitolHH
makes it so that the time will be in 24 hour formathh
Using the lowercasehh
makes it so that the time will be in 12 hour formatmm
Make sure to use lowercasemm
in the date formatting for minutes. This is beacuse the capitolMM
is used for the month.ss
Using the lowercasess
will result in the total seconds in the minuteSS
Using the capitolSS
will result in the total milisecondsaa
Using the lowercaseaa
will result in getting AM or PM