Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to get Month of any date in DB2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
gragha

New User


Joined: 25 Jul 2006
Posts: 23

PostPosted: Tue Feb 13, 2007 10:46 pm    Post subject: How to get Month of any date in DB2
Reply with quote

Hi,

I know that MONTH (CURRENT DATE) will give me the value of the month of that current date.

But if I want to get the month of 2006-12-31 the command
MONTH(2006-12-31) does not work and it gives an SQLCODE of -171
which is THE DATA TYPE, LENGTH, OR VALUE OF ARGUMENT nn OF function-name IS INVALID.

Can you somebody suggest.

Ragha
Back to top
View user's profile Send private message

DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Wed Feb 14, 2007 12:30 am    Post subject: Re: How to get Month of any date in DB2
Reply with quote

Ragha


Put the date in quotes

MONTH('2006-12-31')
Back to top
View user's profile Send private message
gragha

New User


Joined: 25 Jul 2006
Posts: 23

PostPosted: Wed Feb 14, 2007 12:31 am    Post subject: Re: How to get Month of any date in DB2
Reply with quote

Thanks, I just realized it.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts SUBSTR for Date functions Shaheen Shaik DB2 4 Thu Apr 06, 2017 2:14 pm
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us