Home » Developer & Programmer » Forms » Date Function that return Next or Previous Year (Developer 6i, 6, Xp)
Date Function that return Next or Previous Year [message #301055] Tue, 19 February 2008 01:37 Go to next message
azamkhan
Messages: 557
Registered: August 2005
Senior Member
Dear Friends,

I am looking for a Date function that return me next or previous Year. Is there such function?

Regards,
Azam Khan
Re: Date Function that return Next or Previous Year [message #301058 is a reply to message #301055] Tue, 19 February 2008 01:42 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Not really, but you might combine some of them:
SELECT to_char(add_months(sysdate, -12), 'yyyy') last_year,
       to_char(add_months(sysdate, 12), 'yyyy') next_year 
from dual
There are other ways to do that (for example, using the TRUNC function etc., but I guess this might be a good start.
Re: Date Function that return Next or Previous Year [message #301087 is a reply to message #301055] Tue, 19 February 2008 03:05 Go to previous message
akramrabaya
Messages: 41
Registered: November 2007
Member


SQL> select to_char(trunc(sysdate,'year'),'yyyy')-1 last , to_char(trunc(sysdate,'year'),'yyyy')+1 next from dual ;

LAST NEXT
--------- ---------
2007 2009

SQL>




akram
Previous Topic: Problem in Calling Report
Next Topic: ESC KEY
Goto Forum:
  


Current Time: Fri Sep 27 10:32:27 CDT 2024