1.日期: java
@Temporal(TemporalType.DATE)
@Column(name = "createDate", nullable = false, length = 10)
public Date getCreateDate() {
return createDate;
} sql
在頁面端取值:2011-04-12 app
2.時間: .net
@Temporal(TemporalType.TIME) code
在頁面端取值:22:50:30 blog
3.日期和時間(默認): ci
@Temporal(TemporalType.TIMESTAMP)
在頁面端取值:2011-04-12 22:51:34.0 get
TemporalType類型,請看源碼
/**
* Type used to indicate a specific mapping of <code>java.util.Date</code>
* or <code>java.util.Calendar</code>.
*
* @since Java Persistence 1.0
*/
public enum TemporalType {
/**
* Map as <code>java.sql.Date</code>
*/
DATE, 源碼
/**
* Map as <code>java.sql.Time</code>
*/
TIME, class