当前位置:IT教程网教程中心程序开发DB2 → 教程内容

db2如何得到当前系统的时间?getdate(),now()都不行?内空 (无内容

减小字体 增大字体 作者:佚名  来源:不详  发布时间:2006-12-29 13:16:00



 vlife 回复于:2002-11-20 19:55:33
current date

 neo2718 回复于:2002-11-21 00:31:06
CURTIME();CURDATE();或者使用专用寄存器CURRENT TIME ;CURRENT DATE;CURRENT TIMESTAMP

 linking 回复于:2002-11-22 17:42:18
怎么样使用?
select CURTIME() from table
无法使用,我想将时间用在where里或显示在select中

在db2命令行中输入CURTIME(),CURTIME无法识别

 Law 回复于:2002-11-22 23:19:55
毛,应该这样做
db2=>select current time from (values 1) as test
db2=>select current date from (values 2) as test

 linking 回复于:2002-11-23 15:20:43
呵呵,ok:)不过有没有得到毫秒的current?


 toyly 回复于:2002-11-24 09:40:02
使用microsecond() 如下:

-------------------------------输入的命令-------------------------------
select current timestamp,microsecond(current timestamp) from (values 1) as test 
------------------------------------------------------------------------

1                          2          
-------------------------- -----------
2002-11-24-09.21.19.383002      383002

  1 条记录已选择。

 linking 回复于:2002-11-24 16:37:08
very thanks


 stevenyan 回复于:2003-05-19 21:01:57
db2 "get  current timestamp from table1"得到当前时间搓
如何取得当前时间搓加上7天的值?
DB2有没有提供类似的函数

举例
当前日期值                                  期望得到值
2003-12-31-01.00.00.000000          2004-01-06-01.00.00.000000
2000-02-26-01.00.00.000000          2000-03-03-01.00.00.000000
...

我用java查询DB2表中某一段日期的数据,
java 里好象也没有类似当前日期+天数得到新的日期运算函数
或者有没有其他的办法解决?

 刘星宇 回复于:2003-09-12 13:03:55
db2 "values current date + 7 days"
注解:结果为当前的时间加7天

 yuliu777 回复于:2003-12-05 10:29:36
select current time from (values 1) as test  中的values 1 是什么意思?我是初学者,不好意思

广告位置