如何获得Oracle 11g中两个日期之间的天数? [英] How can I get the number of days between 2 dates in Oracle 11g?

查看:63
本文介绍了如何获得Oracle 11g中两个日期之间的天数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Oracle 11g中找到两个日期之间的整数天数.

I'm trying to find an integer number of days between two dates in Oracle 11g.

我可以通过这样做来接近

I can get close by doing

select sysdate - to_date('2009-10-01', 'yyyy-mm-dd') from dual

但这会返回一个间隔,并且我尚未成功将其强制转换为整数.

but this returns an interval, and I haven't been successful casting this to an integer.

显然是10g,它以整数形式返回天数.

Apparently in 10g, this returns the number of days as an integer.

推荐答案

我自己弄清楚了.我需要

I figured it out myself. I need

select extract(day from sysdate - to_date('2009-10-01', 'yyyy-mm-dd')) from dual

这篇关于如何获得Oracle 11g中两个日期之间的天数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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