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 Do i get date format YYYYMMDD or MMDDYYYY.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: How Do i get date format YYYYMMDD or MMDDYYYY.
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: 171
Location: Bangalore

PostPosted: Mon May 15, 2006 8:31 pm    Post subject:
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    Post subject: Re: How Do i get date format YYYYMMDD or MMDDYYYY.
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    Post subject: Re: How Do i get date format YYYYMMDD or MMDDYYYY.
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    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 TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts output data in CSV Format janmejay COBOL Programming 8 Sat Oct 15, 2016 2:20 pm


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