I\'m creating my JavaFX application and I need to use time label every time new list cell is created. I need to put the string with current time in HH:MM format
LocalTime.now().format(DateTimeFormatter.ofPattern("HH:mm"))
(this will use the default locale, see https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#ofPattern-java.lang.String- for more).
But better practice would be to put the formatter into a static final field. This way it's only created once instead of every time the line is exectuted. It nearly certainly doesn't really matter for this application, but it's better to use good habits from the beginning.