Jordan Software Solutions, Inc.
Welcome at » Websphere MQBroker – Converting Char TimeStamp to TIMESTAMP and GMTTIMESTAMP

Websphere MQBroker – Converting Char TimeStamp to TIMESTAMP and GMTTIMESTAMP

First of all, can people be a little nicer on message boards/help forums?  It really doesn’t matter if you agree with someone’s requirements and I’d like to give people the benefit of the doubt that they have already searched for theire answer and are posting because (a) they need help and (b) that’s what the forums are for.

Anyway…

I had a message flow that received an XML message that contained an attribute with a timestamp in char/string form, e.g., “2015-02-17T16:17:22.000Z”.  Note that this string is a representation of a GMT timestamp.  I needed to store the GMT date/time and the date/time converted to the local time zone.

I googled and came up empty with a clear answer for how to convert this to a variable of type GMTTIMESTAMP and/or TIMESTAMP.  Guess what?  It’s profoundly easy.

set Environment.Variables.originalDate = inputXmlMessage.createdDateTime;
set Environment.Variables.dateAsGMTTimestamp = cast(inputXmlMessage.createdDateTime as GMTTIMESTAMP format 'I');
set Environment.Variables.dateAsLocalTimestamp = CAST(cast(inputXmlMessage.createdDateTime as GMTTIMESTAMP format 'I') as timestamp);

Note that the “format ‘I’” portion is specific to my string representation, but you get the idea.

 

 

Leave a Reply

You must be logged in to post a comment.