How to show the time in the lookup with 12 hours

Hi Gleb,
In my case, i want to see the time in 12 hour mode in the lookupField, where it is from the Instance Name like the below image…


How to show the time in the lookup with 12 hours…?


You can create instans name in the method and format the date and time there as you need.

public String getCaption(){
    SimpleDateFormat simpleDateFormat12H = new SimpleDateFormat("hh:mm", Locale.UK);
    String finishDateFormated= simpleDateFormat12H(finishDate);
    String startDateFormated= simpleDateFormat12H(startDate);
    return String.format("%s - %s to %s", cource, startDateFormated, finishDateFormated);

And you can use the method of setOptionCaptionProvider from lookupField
to convert the display of the option list.

I didn’t check the code at the IDE. It’s just an illustration of the way.