Posted: Mon Feb 27, 2017 7:49 pm Post subject: DateTime getting Converted into UTC
Newbie
Joined: 17 Jul 2014 Posts: 9
Hi All,
I am trying to convert DateTime field in the request into a String format as expected by the backend server. I am using mapping node as there are many other fields being mapped. From the mapper a Custom ESQL function is being called with following code
Code:
CREATE FUNCTION ConvertToString (IN inputDateTime TIMESTAMP) RETURNS CHAR
BEGIN
RETURN CAST(inputDateTime AS CHARACTER FORMAT 'yyyyMMdd''T''HHmmss');
END;
2016-11-04T21:55:34+13:00 is resulting in 20161104T215534, as expcted
and 2016-11-04T21:55:34Z is resulting in 20161105T105534, as expcted but
2016-11-04T21:55:34 is also resulting in 20161105T105534. This means when there is no Z or offset in the DateTime field WMB is converting the DateTime into UTC when the mapper calls the ESQL Function. Is it due to any setting (configurable service) at the Broker level. Please advice.
Thanks in advance
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
There is a who page (or two) in the documentation on Timestamp Conversion formats.
You can force the inclusion of the Zulu offset if you so wish by using the correct string. You are almost there with your example but there are some shortform templates that may make your job easier. _________________ 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.
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