IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

comarison of dates in USA and non USA format


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Dec 07, 2010 7:06 pm
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
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: 6966
Location: porcelain throne

PostPosted: Tue Dec 07, 2010 7:50 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts InfoSphere OPTIM CSV ouput vs DSNTIUA... IBM Tools 3
No new posts Need mmmyy date format SYNCSORT 6
Search our Forums:

Back to Top