MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Last Day with leap year

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
NASCAR9
Intermediate


Joined: 08 Oct 2004
Posts: 274
Topics: 52
Location: California

PostPosted: Tue Jun 27, 2006 1:55 pm    Post subject: Last Day with leap year Reply with quote

Can someone else run this query and see if the return is 2004-02-29?

Code:
                                                           
   SELECT DATE(LAST_DAY('1986-02-05' )) + 18 YEARS         
       FROM SYSIBM.SYSDUMMY1;                               
---------+---------+---------+---------+---------+---------+
                                                           
---------+---------+---------+---------+---------+---------+
2004-02-28                                                 
DSNE610I NUMBER OF ROWS DISPLAYED IS 1                     
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100

_________________
Thanks,
NASCAR9
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Jun 27, 2006 2:26 pm    Post subject: Reply with quote

NASCAR9,

You are using the LAST_DAY on the Inner date (1986-02-05) which will yield 1986-02-28 ( as 1986 is not leap year) . You are adding 18 years to 1986-02-28 , so you would always result in 2004-02-28. Change your sql to the following

Code:

SELECT LAST_DAY(DATE('1986-02-05' ) + 18 YEARS) 
FROM SYSIBM.SYSDUMMY1;                           


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
NASCAR9
Intermediate


Joined: 08 Oct 2004
Posts: 274
Topics: 52
Location: California

PostPosted: Tue Jun 27, 2006 2:33 pm    Post subject: Reply with quote

Kolusu,
Once again you have the answer.
Thank You!
_________________
Thanks,
NASCAR9
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group