|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Translate Month |
« View previous topic :: View next topic » |
Author |
Message
|
Rockon |
Posted: Tue Nov 29, 2005 1:08 pm Post subject: Translate Month |
|
|
Apprentice
Joined: 24 May 2004 Posts: 43
|
Hi All,
I was looking for a method to translate the month in the input value which is in MMM format to mm.i.e If i get it as FEB it should translate to '02'.
Currently I am using the IF....THEN...loop...but was wondering if there was any function calls that can do the same..
Input sample: 28-Nov-2005 11:30:57
Expected Output:28:11:2005 11:30:57
Thankyou,
Cheers |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Nov 29, 2005 1:28 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Are you modeling your data?
Are you using v6? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
JT |
Posted: Tue Nov 29, 2005 2:02 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
You could do it like this through ESQL:
Code: |
DECLARE dateSample CHARACTER '28-Nov-2005 11:30:57';
SET Environment.Variables.monthTranslation[] =
LIST{ROW('JAN' AS MMM,'01' AS MM),
ROW('FEB' AS MMM,'02' AS MM),
ROW('MAR' AS MMM,'03' AS MM),
ROW('APR' AS MMM,'04' AS MM),
ROW('MAY' AS MMM,'05' AS MM),
ROW('JUN' AS MMM,'06' AS MM),
ROW('JUL' AS MMM,'07' AS MM),
ROW('AUG' AS MMM,'08' AS MM),
ROW('SEP' AS MMM,'09' AS MM),
ROW('OCT' AS MMM,'10' AS MM),
ROW('NOV' AS MMM,'11' AS MM),
ROW('DEC' AS MMM,'12' AS MM)};
SET dateSample = TRANSLATE(dateSample, SUBSTRING(dateSample FROM 4 FOR 3), THE(SELECT ITEM T.MM FROM Environment.Variables.monthTranslation[] AS T WHERE T.MMM = SUBSTRING(dateSample FROM 4 FOR 3))); |
|
|
Back to top |
|
 |
wooda |
Posted: Thu Dec 01, 2005 2:23 am Post subject: |
|
|
 Master
Joined: 21 Nov 2003 Posts: 265 Location: UK
|
If you using the MRM domain then this is v.easy.
You can model both datetime formats in your message set
and just parse one and write the other.
If you ARE using MRM then let me know and I'll give more info if you need it. |
|
Back to top |
|
 |
Rockon |
Posted: Thu Dec 01, 2005 9:00 am Post subject: |
|
|
Apprentice
Joined: 24 May 2004 Posts: 43
|
Hi All,
Thankyou for the all the inputs.I am still on V5 .The date modelling was basically to transform -- "DD-Mmm-YYYY hh:mm:ss" to 'YYYY-MM-DDThh:mm:ss'
So I used the code snippet and was able to achieve the objective. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|