Format date in using DateTimeConverter

前端 未结 3 428
面向向阳花
面向向阳花 2021-01-24 19:22

I have a that has with CategoryHistory objects loaded in it. I only show the Date date

3条回答
  •  故里飘歌
    2021-01-24 20:17

    You can use a converter method in your bean, as:

    public class Admin{
        ...
            public String formatDate(Date fecha, String pattern) {
                return (new SimpleDateFormat(pattern)).format(fecha);
            }
        ...
    }
    

    And, in your xhtml page inside f:selectItems:

    
    
    

提交回复
热议问题