Title: JSF convertDateTime render timestamp wrong
Tags: datetime;jsf;primefaces;format;converter
Question: PrimeFaces 6.1, WebLogic 12cR2
I'm trying list out a bunch of entities in . Data was kept in PostgreSQL, xhtml snippet as:
<p:dateTable&gt;
......
<p:column headerText="#{clientpayment['web.payment.label.created']}"&gt;
<h:outputText value="#{payment.created}"&gt;
<f:convertDateTime pattern="dd MMM yy HH:MM:SS.mmm" /&gt;
</h:outputText&gt;</p:column&gt;
.......
</p:dataTable&gt;
JSF default locale was set to my system locale in web.xml configure file:
<context-param&gt;
<param-name&gt;javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name&gt;
<param-value&gt;true</param-value&gt;
</context-param&gt;
Entity was declared as:
@Basic
@Temporal(TemporalType.TIMESTAMP)
@javax.persistence.Column(name = "created", nullable = true, insertable = true, updatable = true)
private Date created;
public Date getCreated() {
return created;
public void setCreated(Date created) {
this.created = created;
Database shows timestamp as:
seams the data was kept in good order.
But when I run application the result is very funny. Only year, month, date and seconds info rendering properly, any thing else (hour,minute and milliseconds) were wrong.
Any idea about the funny thing? Is it a bug or some thing wrong in my application? Please advise!!
Comment: Does it work if not used in a PrimeFaces datatable?


Here is another answer: Date time format inside pattern attribute of your f:convertDateTime element is not correct.
It should be dd MMM yy HH:mm:ss.SSS
Comment for this answer: Tried. Nothing different.
Comment for this answer: Then you are most likely not running the code you think you are running
Comment for this answer: @cidy.long Did you maybe try, just for testing purposes, to apply some other date time format? For example, dd-MM-yyyy HH:mm:ss. Does it give correct output?

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2017:00:10/27/17', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<datetime><jsf><primefaces><format><converter>', 'Title': 'JSF convertDateTime render timestamp wrong', 'ViewCount': 825, 'id': 46984937, 'user_AboutMe': '<p>I used work in Java Application many years, but I stopped in 8 years ago. Now, I have some time, so I back again, but I found everything is different, I have to learn a lots of new thing to keep me move ahead. Please help me catch up my lost time.</p>\n', 'user_AccountId': 3739112.0, 'user_DisplayName': 'cidy.long', 'user_Reputation': 417.0, 'user_Views': 154.0, 'user_id': 3109289.0}}