数据库中的日期类型处理:Timestamp

数据库中的日期类型处理:Timestamp

<fmt:formatDate  //只能承接java.unti.Date

Cannot convert of type class java.sql.Timestamp to class org.joda.time.DateTime

1,

Add this annotation on your DateTime field in your entity class

@Type(type="org.joda.time.contrib.hibernate.PersistentDateTime")

private DateTime birthDay;

And in your JSP, keep using the joda format tag:

<c:set var="formattedDateTimeValue">

  <joda:format value="${DateTimeValue}" pattern="dd.MM.yyyy" />

  <!-- Or any pattern you want -->

</c:set>

2,sql中采用to_char(T.WL_TIME,'yyyy-mm-dd hh24:mi:ss')//这种最省事

猜你喜欢

转载自yuhuiblog6338999322098842.iteye.com/blog/2322743
今日推荐