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

How Do i get date format YYYYMMDD or MMDDYYYY.


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sureshbabu.jv

New User


Joined: 11 Apr 2006
Posts: 41
Location: Chennai

PostPosted: Mon May 15, 2006 8:03 pm
Reply with quote

I want to get YYYYMMDD format from system in DB2 whenver i use Accept date function.

Thanks
Suresh
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 174
Location: Bangalore

PostPosted: Mon May 15, 2006 8:31 pm
Reply with quote

Hi,
ANSWER
SELECT CHAR(CURRENT DATE,ISO) AS iso ==> 2005-11-30
,CHAR(CURRENT DATE,EUR) AS eur ==> 30.11.2005
,CHAR(CURRENT DATE,JIS) AS jis ==> 2005-11-30
,CHAR(CURRENT DATE,USA) AS usa ==> 11/30/2005
FROM sysibm.sysdummy1;

I think this helps you

Please correct me if I am Wrong
Back to top
View user's profile Send private message
getdpk

New User


Joined: 06 Feb 2006
Posts: 2

PostPosted: Tue May 16, 2006 11:54 am
Reply with quote

Please use the following

Accpet WS-CURRENT-DATE FROM DATE YYYYMMDD

Thanks,
Deepak [/quote]
Back to top
View user's profile Send private message
krish_mrt

New User


Joined: 15 Apr 2005
Posts: 12
Location: Chennai

PostPosted: Thu May 25, 2006 3:25 pm
Reply with quote

Hi,

if you want the format exactly as you have specified, then you can try this...


Code:
select
year(<timestamp_value>)||
case
when month(<timestamp_value>)> 9 then ''||month(<timestamp_value>)
when month(<timestamp_value>)< 10 then '0'||month(<timestamp_value>)
end ||
case
when day(<timestamp_value>)> 9 then ''||day(<timestamp_value>)
when day(<timestamp_value>)< 10 then '0'||day(<timestamp_value>)
end
from 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 Need help to append a date&tsp at... DFSORT/ICETOOL 9
No new posts InfoSphere OPTIM CSV ouput vs DSNTIUA... IBM Tools 3
Search our Forums:

Back to Top