ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Conversion of date format

Post new topic  Reply to topic
 Conversion of date format « View previous topic :: View next topic » 
Author Message
lokeshraghuram
PostPosted: Fri Feb 07, 2014 10:06 pm    Post subject: Conversion of date format Reply with quote

Novice

Joined: 10 Dec 2013
Posts: 14

Hello Everyone

Can anyone help me to convert dd/mm/yyyy format to YYYYMMDD using single esql statement??
Back to top
View user's profile Send private message
smdavies99
PostPosted: Fri Feb 07, 2014 10:11 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Why do you need to do it in a single statement?

How do you think it can be done NOT in a single statement?
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
lokeshraghuram
PostPosted: Fri Feb 07, 2014 10:25 pm    Post subject: Reply with quote

Novice

Joined: 10 Dec 2013
Posts: 14

I am extracting DD,MM,YYYY using substring and concatenating to get the required format. This is quite complex..Is there an easy way to do this?
Back to top
View user's profile Send private message
dogorsy
PostPosted: Fri Feb 07, 2014 10:32 pm    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

lokeshraghuram wrote:
I am extracting DD,MM,YYYY using substring and concatenating to get the required format. This is quite complex..Is there an easy way to do this?


Similar questions have been asked several times in this forum. You only need to search it, or look at the available functions in the infocentre.
Back to top
View user's profile Send private message
Gralgrathor
PostPosted: Mon Feb 10, 2014 2:27 am    Post subject: Re: Conversion of date format Reply with quote

Master

Joined: 23 Jul 2009
Posts: 297

lokeshraghuram wrote:
Can anyone help me to convert dd/mm/yyyy format to YYYYMMDD using single esql statement??



In two statements:

Code:
-- DECLARE inputDate CHARACTER; -- contains date in format dd/mm/yyyy
DECLARE toTimestamp TIMESTAMP CAST(inputDate as TIMESTAMP FORMAT 'dd/MM/yyyy');
DECLARE toString CHARACTER CAST(toTimestamp as CHARACTER FORMAT 'yyyyMMdd');


Integrate, and you get

Code:
DECLARE toString CHARACTER CAST(CAST(inputDate as TIMESTAMP FORMAT 'dd/MM/yyyy') as CHARACTER FORMAT 'yyyyMMdd');


But really, all of this is documented at the info pages for the CAST function.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Conversion of date format
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.