如何在derby中将时差转换为小时(小数点后两位)? [英] How to convert the time difference to hours(with 2 decimal place) in derby?

查看:89
本文介绍了如何在derby中将时差转换为小时(小数点后两位)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在derby db中使用timestampdiff来检索2个时间之间的时间差:开始日期和结束日期。例如

I am using timestampdiff in derby db to retrieve the time difference between 2 time: startdate, and enddate. e.g.

开始日期= 2010-02-23 02:59:52.045
结束日期= 2010-02-23 03:45:39.898

select {fn timestampdiff(SQL_TSI_HOUR, startdate, enddate)} as diff 

我想知道如何获得以小时为单位的时间差,例如0.25等?

I would like to know how can I get the time diff in hours, e.g. 0.25, etc?

谢谢。

推荐答案

select {fn timestampdiff(SQL_TSI_MINUTE, startdate, enddate)}/60 as diff 

然后我将变量称为startdatetime和enddatetime。

and I would call the variables startdatetime and enddatetime.

这篇关于如何在derby中将时差转换为小时(小数点后两位)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆