I have a database column of type date with the following value
2014-05-01
I then have the following hibernate mapping:
@Temporal(TemporalType.DATE)
@Column(name = "end_date", nullable = false, length = 13)
public Date getEndDate() {
return this.endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
When I reference this date in a JSF page in the following way
<h:outputText value="#{someBean.endDate}">
<f:convertDateTime pattern="d MMM yyyy" />
</h:outputText>
It reads as
'30 Apr 2014'
So I remove the f:convertDateTime and it shows:
'5/1/2014'
So I then change the f:convertDateTime to:
<h:outputText value="#{someBean.endDate}">
<f:convertDateTime pattern="HH:mm d MMM yyyy" />
</h:outputText>
And it reads:
'23:00 30 Apr 2014'
So my guess is that my computer is set to BST (British Summer Time) and the date in the database is somehow set to GMT (or Zulu time) so that the -1 hour causes the date to move back in time to the previous day?
Is there any way to stop this happening, I just want to treat it as a date, with no time component!