[轉貼]hibernate jpa 註解 @Temporal(TemporalType.DATE) 日期註解
1) DATE :等於java.sql.Date
2) TIME :等於java.sql.Time
3) TIMESTAMP :等於java.sql.Timestamp
1.日期:
[color=red]@Temporal(TemporalType.DATE)[/color]
@Column(name = "applyDate", nullable = false, length = 10)
public Date getApplyDate() {
return applyDate;
}
在頁面端取值:2011-07-05
2.時間:
[color=red]@Temporal(TemporalType.TIME)[/color]
在頁面端取值:22:50:30
3.日期和時間([color=red]默認[/color]):
[color=red]@Temporal(TemporalType.TIMESTAMP)[/color]
在頁面端取值:2011-07-05 22:51:34:000
在jsp裏控制不顯示毫秒:
<td align="center"> <fmt:formatDate value="${list[0].createTime}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
轉載自:[url]http://blog.csdn.net/liguiping2000/article/details/6976738[/url]
2) TIME :等於java.sql.Time
3) TIMESTAMP :等於java.sql.Timestamp
1.日期:
[color=red]@Temporal(TemporalType.DATE)[/color]
@Column(name = "applyDate", nullable = false, length = 10)
public Date getApplyDate() {
return applyDate;
}
在頁面端取值:2011-07-05
2.時間:
[color=red]@Temporal(TemporalType.TIME)[/color]
在頁面端取值:22:50:30
3.日期和時間([color=red]默認[/color]):
[color=red]@Temporal(TemporalType.TIMESTAMP)[/color]
在頁面端取值:2011-07-05 22:51:34:000
在jsp裏控制不顯示毫秒:
<td align="center"> <fmt:formatDate value="${list[0].createTime}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
轉載自:[url]http://blog.csdn.net/liguiping2000/article/details/6976738[/url]
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.