Posted: Wed Mar 01, 2017 8:16 am Post subject: CASTING issue while adding timezone offset
Apprentice
Joined: 24 May 2004 Posts: 43
any hints on the correct format I should be using for casting localtime(without seconds)+timezoneeffect
IIB V9.0.0.6
Code:
DECLARE source CHARACTER '10:00-5:00';
DECLARE target TIME;
DECLARE fmt CHARACTER 'HH:mmZZZ';
SET target = CAST(source AS TIME FORMAT fmt );
SET Environment.Variables.target = target;
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
mqjeff wrote:
"HH:mm-ZZZ"
There is a whole section in the documentation that details all the valid format options. It might be a good idea to bookmark it for future reference. _________________ 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.
DECLARE source CHARACTER '10:00-05:00';
DECLARE target TIME;
DECLARE fmt CHARACTER 'HH:mmZZZ';
SET target = CAST(source AS TIME FORMAT fmt );
SET Environment.Variables.target = target;
Note 5:00 is changed to 05:00
A ZZZ format construct matches "time zone (+/-nn:nn)" leading zeros are significant I believe. _________________ Independent Middleware Consultant
andy@knownentity.com
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