ITPub博客

首页 > 数据库 > 数据库开发技术 > informix 中算两个时间差(求时间间隔)

informix 中算两个时间差(求时间间隔)

原创 数据库开发技术 作者:liahtobjtosh 时间:2009-11-24 08:20:51 0 删除 编辑
informix 中算两个时间差(求时间间隔)[@more@]

> create table tt(c1 datetime year to second,c2 datetime year to second);

Table created.

> insert into tt values('1900-11-24 00:00:00',sysdate);

1 row(s) inserted.

> select (((c2-c1)::interval minute(9) to minute)||'')::integer from tt;


(expression)

57329829

1 row(s) retrieved.

>

或:

> select substr((c2-c1)*24*60,1,10) from tt;


(expression)

57329840

1 row(s) retrieved.

>

注意:如果转换成秒有可能产生溢出,所以还得使用另外的解决方法。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22565551/viewspace-1028988/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-09-19

  • 博文量
    48
  • 访问量
    249171