How to get the hour difference between 2 datetimestamp on derby db?

陌路散爱 提交于 2020-01-04 06:30:32

问题


I have a sql question on derby database:

Select a.name, a.starttime, a.endtime
From a

How can I add to the above sql statement such that I can get the difference in hours between the start time and end time? (I only know that for mysql there is a DATEDIFF function, but I am not sure about what function should I use for derby db)

Thanks.


回答1:


In Derby there is a TIMESTAMPDIFF:

for instance:

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


来源:https://stackoverflow.com/questions/2324522/how-to-get-the-hour-difference-between-2-datetimestamp-on-derby-db

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!