用PL/SQL [duplicate]从日期中减去天数

时间:2022-08-25 18:08:57

This question already has an answer here:

这个问题已经有了答案:

I would like to subtract a given x number of days from sysdate, can someone assist me on how to do that, I am using the PL/SQL language. THANKS!

我想从sysdate中减去给定的x天,谁能帮助我实现这一点,我正在使用PL/SQL语言。谢谢!

2 个解决方案

#1


41  

Use sysdate-1 to subtract one day from system date.

使用sysdate-1从系统日期中减去一天。

select sysdate, sysdate -1 from dual;

Output:

输出:

SYSDATE  SYSDATE-1
-------- ---------
22-10-13 21-10-13 

#2


5  

simply,

简单地说,

select sysdate-1 from dual

there's a bunch more info and detail here: http://www.orafaq.com/faq/how_does_one_add_a_day_hour_minute_second_to_a_date_value

这里有更多的信息和细节:http://www.orafaq.com/faq/how_one_add_a_day_hour _minute_second_to_a_date_value

#1


41  

Use sysdate-1 to subtract one day from system date.

使用sysdate-1从系统日期中减去一天。

select sysdate, sysdate -1 from dual;

Output:

输出:

SYSDATE  SYSDATE-1
-------- ---------
22-10-13 21-10-13 

#2


5  

simply,

简单地说,

select sysdate-1 from dual

there's a bunch more info and detail here: http://www.orafaq.com/faq/how_does_one_add_a_day_hour_minute_second_to_a_date_value

这里有更多的信息和细节:http://www.orafaq.com/faq/how_one_add_a_day_hour _minute_second_to_a_date_value