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
 

 

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: 10277
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 Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm
No new posts How to pick only YYMMDD from DATE1P (... atulbaviskar SYNCSORT 7 Wed Mar 22, 2017 11:39 am
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm


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