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 » TimeStamp Casting Error

Post new topic  Reply to topic
 TimeStamp Casting Error « View previous topic :: View next topic » 
Author Message
rharikumar
PostPosted: Fri Feb 14, 2014 3:46 am    Post subject: TimeStamp Casting Error Reply with quote

Novice

Joined: 14 Oct 2013
Posts: 16

Hi

I am trying to cast current_timestamp to a specific format and i am not able to achieve the desired result .

Declare targetFormat CHARACTER;
SET targetFormat = 'yyyy-MM-ddTHH:mm:ss.SSS';
SET Environment.Variable.Test3=cast(CURRENT_GMTTIMESTAMP as TIMESTAMP FORMAT 'yyyy-MM-ddTHH:mm:ss.SSS');

The output is - 2014-02-14 11:42:57.270008
Expected Output - 2014-02-14T11:42:57.270008

Kindly provide some guidance . Thanks in advance .
Back to top
View user's profile Send private message
Simbu
PostPosted: Fri Feb 14, 2014 3:54 am    Post subject: Reply with quote

Master

Joined: 17 Jun 2011
Posts: 289
Location: Tamil Nadu, India

Please refer
http://pic.dhe.ibm.com/infocenter/wmbhelp/v8r0m0/topic/com.ibm.etools.mft.doc/ak05616_.htm
Back to top
View user's profile Send private message
rharikumar
PostPosted: Fri Feb 14, 2014 4:10 am    Post subject: Reply with quote

Novice

Joined: 14 Oct 2013
Posts: 16

Hi Simbhu

Thanks ...I am aware of this reference .

Unless i CAST it to a CHARACTER .. I am unable to bring the 'T' between the date and time .

Formatting it to IU also doest work.
Back to top
View user's profile Send private message
Simbu
PostPosted: Fri Feb 14, 2014 4:34 am    Post subject: Reply with quote

Master

Joined: 17 Jun 2011
Posts: 289
Location: Tamil Nadu, India

Did you read this?

Quote:
ESQL data type TIMESTAMP or GMTTIMESTAMP
Output form yyyy-MM-dd'T'HH:mm:ss.SSSZZZ


the output form itself is having 'T'

also you must cast the timestamp to string and not to timestamp itself with pattern
Back to top
View user's profile Send private message
Gralgrathor
PostPosted: Fri Feb 14, 2014 4:46 am    Post subject: Reply with quote

Master

Joined: 23 Jul 2009
Posts: 297

You'll have to include the quotes around the 'T', as documented here:
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fak05616_.htm

Which means you'll have to escape the quotes.

Code:
DECLARE google CHARACTER CAST(CURRENT_TIMESTAMP as CHARACTER FORMAT 'yyyy-MM-dd''T''HH:mm:ssSSSSS');
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Fri Feb 14, 2014 4:56 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Timestamps don't have formats.

Formats are used to parse character data into timestamps or serialize timestamps into characters.

If a field of type TIMESTAMP is not being output from the message tree correctly, then it's a problem with the model being used.
Back to top
View user's profile Send private message
rharikumar
PostPosted: Fri Feb 14, 2014 4:59 am    Post subject: Reply with quote

Novice

Joined: 14 Oct 2013
Posts: 16

Thanks all for the suggestions .

@Gralgrathor - I did try that . Thanks anyway .

The only problem is i have the casting in place but when the milliseconds are 000 ..they somehow get trimmed and is resulting in a validation failure .

Expected - 2014-02-14T11:42:57.270008
What happens when milliseconds are 0 - 2014-02-14T11:42:57.2700

Thats where i am stuck .
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Feb 15, 2014 7:38 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

You are sure you have the right number of capital S at the end of your format clause?
_________________
MQ & Broker admin
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 » TimeStamp Casting Error
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.