DB2日期自动转换成时间戳,是在后面加六个0吗,比如20140101,会变成20140101000000
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
1个回答
展开全部
>db2 "create table test123(aa timestamp)"
DB20000I The SQL command completed successfully.
>db2 "insert into test123 values (current timestamp)"
DB20000I The SQL command completed successfully.
>db2 "select * from test123 where date(aa)='2014-11-07'"
AA
--------------------------
2014-11-07-16.30.34.618413
1 record(s) selected.
>db2 "select date(aa) from test123 where date(aa)='2014-11-07'"
1
----------
2014-11-07
1 record(s) selected.
DB20000I The SQL command completed successfully.
>db2 "insert into test123 values (current timestamp)"
DB20000I The SQL command completed successfully.
>db2 "select * from test123 where date(aa)='2014-11-07'"
AA
--------------------------
2014-11-07-16.30.34.618413
1 record(s) selected.
>db2 "select date(aa) from test123 where date(aa)='2014-11-07'"
1
----------
2014-11-07
1 record(s) selected.
追问
先谢谢你的回答。
比如:
createDate
20141009000000
20141011111111
20141030000000
20141031111111
createDate between '20141010' and '20141030'
结果应该是
20141011111111
20141030000000
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询