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: 548
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: 20890
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: Sat Dec 03 13:53:16 CST 2016

Total time taken to generate the page: 0.14480 seconds