substracting/change date value [message #261005] |
Tue, 21 August 2007 09:02 |
nashrul
Messages: 7 Registered: August 2007 Location: Indonesia
|
Junior Member |
|
|
I have this snippet in korn shell. I would like to get last day of current date. So, I do the query below.
last_date=`sqlplus -s PUNDISM2/PUNDISM2@PUNDISM<<eof
set serveroutput on;
set pagesize 0;
set heading off;
set feedback off;
set linesize 1000;
select to_char(last_day(sysdate), 'YYYY-MM-DD') from dual;
EXIT;
eof`
The problem is the machine time is set 1 year in advance (I cannot change this since it is beyond my authority). So, i will get 2008-08-21 instead of 2007-08-21 from this query. I need to substract this by one year so I get the real last day of the current time. How can i do this ??
|
|
|
|
|