|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
CURRENT_GMTTIMESTAMP format |
« View previous topic :: View next topic » |
Author |
Message
|
vids |
Posted: Fri Apr 08, 2005 4:00 pm Post subject: CURRENT_GMTTIMESTAMP format |
|
|
 Acolyte
Joined: 24 Mar 2003 Posts: 68 Location: CA, USA
|
Hi,
We are sending the timestamp to the output message in the format 1999-12-31T23:59:59.999Z.
In the compute node we get the CURRENT_GMTTIMESTAMP and format it as below...
DECLARE strGMTTimeStamp CHARACTER;
DECLARE newstrGMTTimeStamp CHARACTER;
SET strGMTTimeStamp =CAST(CURRENT_GMTTIMESTAMP AS CHARACTER);
SET newstrGMTTimeStamp = SUBSTRING(strGMTTimeStamp FROM 15 FOR 10) || 'T' ||SUBSTRING(strGMTTimeStamp FROM 26 FOR 12) || 'Z';
NOTE: If you print the CURRENT_GMTTIMESTAMP, it will be in the format: GMTTIMESTAMP '2005-04-08 12:19:44.923'
Assuming it will be the same format always, the above string operation was done. It works fine but sometimes we see "'" in the timestamp in output message. Here is how it looks like "2005-03-02T19:44:14'Z".
I'm guessing if the CURRENT_GMTTIMESTAMP has zero milliseconds, instead of getting the date as "GMTTIMESTAMP '2005-04-08 12:19:44.000'" it gets the date in the format "GMTTIMESTAMP '2005-04-08 12:19:44'" i.e with no milliseconds. In this case our string operation fails. Since there is no milliseconds at all, the last apostope is added to our newstrGMTTimeStamp.
I don't see anywhere in the documents exact format of the CURRENT_GMTTIMESTAMP. I'm not sure if we are getting this "'" because of the zero milliseconds. But it looks like that.
We are using WBIMB 5.0.2.
Any ideas???
Thanks
Vids |
|
Back to top |
|
 |
JT |
Posted: Mon Apr 11, 2005 5:54 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Add some flexibility, rather than hard-coding the values:
Code: |
DECLARE strGMTTimeStamp CHARACTER;
SET strGMTTimeStamp = CAST(CURRENT_GMTTIMESTAMP AS CHARACTER);
DECLARE startPos INTEGER POSITION('''' IN strGMTTimeStamp) + 1;
DECLARE endPos INTEGER POSITION('''' IN strGMTTimeStamp REPEAT 2);
DECLARE newstrGMTTimeStamp CHARACTER;
SET newstrGMTTimeStamp = SUBSTRING(strGMTTimeStamp FROM startPos FOR (endPos - startPos)) || 'Z';
SET newstrGMTTimeStamp = REPLACE(newstrGMTTimeStamp, ' ', 'T'); |
|
|
Back to top |
|
 |
samgunddi |
Posted: Mon Apr 11, 2005 5:59 am Post subject: |
|
|
 Acolyte
Joined: 17 May 2004 Posts: 54
|
|
Back to top |
|
 |
vids |
Posted: Mon Apr 11, 2005 9:36 am Post subject: |
|
|
 Acolyte
Joined: 24 Mar 2003 Posts: 68 Location: CA, USA
|
|
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
|
|
|
|