Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
comarison of dates in USA and non USA format

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

New User


Joined: 24 Jul 2007
Posts: 18
Location: india

PostPosted: Tue Dec 07, 2010 7:01 pm    Post subject: comarison of dates in USA and non USA format
Reply with quote

Hi,

I am fetching a date from the table in USA format like

SELECT CHAR(CURRENT_DATE,USA)
FROM SYSIBM.SYSDUMMY1

In further processing I need to compare above fetched date with some other DB2 date. Since the above date is fetched as character, comparison is not good.

Any suggestions????

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

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10327
Location: italy

PostPosted: Tue Dec 07, 2010 7:06 pm    Post subject: Reply to: comarison of dates in USA and non USA format
Reply with quote

the only answers that this kind of question deserves belong to the category...
technically correct, but useless

one example of such an answer would be
make sure that the dates You want to process/compare are all in the same format!
or
when fetching dates convert them to a common format
or ...

it would be good for You to read and meditate on
How To Ask Questions The Smart Way
http://catb.org/~esr/faqs/smart-questions.html

if You search the forums on the ways of fetching dates in different formats
or converting dates between different formats You will get lots of hits!

but... do You have a doctors prescription to fetch it in char format...
fetch it in a format consistent with the other date formats in Your program!
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Tue Dec 07, 2010 7:50 pm    Post subject:
Reply with quote

to add on to Enrico's comment,

instead of
Code:

SELECT CHAR(CURRENT_DATE,USA)
FROM SYSIBM.SYSDUMMY1


Code:

SELECT CHAR(CURRENT_DATE,USA)
     , CHAR(CURRENT_DATE,otherformat)
     , CURRENT_DATE
FROM SYSIBM.SYSDUMMY1
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 Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts FTP data transfer from PC to Mainfram... AJAYREDDY All Other Mainframe Topics 8 Wed Aug 23, 2017 9:59 pm
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us