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!
The DATE_SUB() function subtracts a time/date interval from a date and then returns the date.
Use sysdate-1 to subtract one day from system date. Save this answer.
Date – dateYou can subtract a date from a date in Oracle. The result will be in days. You can also multiply by 24 to get hours and so on.
To count the difference between dates as days in PostgreSQL or Oracle, you simply need to subtract one date from the other, e.g. arrival - departure .
Use sysdate-1 to subtract one day from system date.
select sysdate, sysdate -1 from dual;
Output:
SYSDATE SYSDATE-1 -------- --------- 22-10-13 21-10-13
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With