Author |
Message
|
dosttumhara1810 |
Posted: Mon Jul 22, 2013 12:26 am Post subject: Daylight saving issue |
|
|
Voyager
Joined: 01 Dec 2010 Posts: 76
|
I have arequirement of converting the time coming as input (GMT format)to local time of the zone where server is located. I am using using code to convert GMT time to local time. My Broker server is in UK
DECLARE inTime GMTTIMESTAMP;
DECLARE outTime TIMESTAMP;
SET inTime = CAST(InputRoot.XMLNSC.Time.GMTTime AS GMTTIMESTAMP FORMAT 'IU');
SET outTime = CAST(inTime AS TIMESTAMP);-- the result value is source value plus the local time zone
SET OutputRoot.XMLNSC.Response.LocalTime = CAST(outTime AS CHARACTER FORMAT 'yyyy-MM-dd''T''HH:mm:ss ZZZ');
But it is giving me expected output for smmmer BST time but unexpected output for winter BST datetime. For ex:-
Case 1: If input time is 2014-07-08T16:15:09.000Z then output is 2014-07-08T17:15:09 +01:00 which is correct.
Case 2: If input time is 2014-12-08T16:15:09.000Z then output is 2014-12-08T17:15:09 +00:00 which is wrong instead it should not change since in winter GMT and BST time is same and offset is 0.
Kindly help where is the above code wrong or is there another function to be used. |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Jul 22, 2013 12:33 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Do a search on this forum for
LOCAL_TIMEZONE
This may help you with your problem. _________________ 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. |
|
Back to top |
|
 |
dosttumhara1810 |
Posted: Mon Jul 22, 2013 1:20 am Post subject: |
|
|
Voyager
Joined: 01 Dec 2010 Posts: 76
|
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Jul 22, 2013 1:54 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Hmmm This code
Code: |
declare cTimeInput Character;
declare tGMTTime GMTTIMESTAMP;
declare tBSTTime TIMESTAMP;
declare c1, c2 CHARACTER;
set cTimeInput = InputRoot.XMLNSC.Data.gmttime;
set tGMTTime = cast(cTimeInput as gmttimestamp);
set tBSTTime = tGMTTime + LOCAL_TIMEZONE;
set OutputRoot.XMLNSC.Data.input_time = cTimeInput;
set OutputRoot.XMLNSC.Data.gmt_time = cast(tGMTTime as char format 'IU');
set tBSTTime = tGMTTime;
set OutputRoot.XMLNSC.Data.xxx_time = cast(tBSTTime as char format 'I');
|
gives this output
Code: |
<Data>
<input_time>2013-07-22 09:39:59.258617</input_time>
<gmt_time>2013-07-22T09:39:59.258Z</gmt_time>
<xxx_time>2013-07-22T12:39:59.258+03:00</xxx_time>
</Data>
|
from this input
Code: |
<Data>
<gmttime>2013-07-22 09:39:59.258617</gmttime>
</Data>
|
This was done on a system with the timezone set to GMT+3 (Jordan, Saudi) _________________ 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. |
|
Back to top |
|
 |
nukalas2010 |
Posted: Mon Jul 22, 2013 3:39 am Post subject: |
|
|
 Master
Joined: 04 Oct 2010 Posts: 220 Location: Somewhere in the World....
|
smdavies99 wrote: |
This was done on a system with the timezone set to GMT+3 (Jordan, Saudi) |
Sir, are you from Jordan ???  |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Jul 22, 2013 3:59 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
No. I'm in the UK but the VM I used is setup for Jordan.
Why do you ask? _________________ 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. |
|
Back to top |
|
 |
rekarm01 |
Posted: Mon Jul 22, 2013 5:58 pm Post subject: Re: Daylight saving issue |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
dosttumhara1810 wrote: |
DECLARE outTime TIMESTAMP; |
The TIMESTAMP data type does not have a timezone property; it does not fully support timezones. The message flow uses the LOCAL_TIMEZONE offset to CAST between TIMESTAMP and GMTTIMESTAMP, but that's based on the current time, rather than the timestamp time.
There is an APAR available that may resolve this issue, targeted for delivery in WMB v8.0.0.3. |
|
Back to top |
|
 |
dosttumhara1810 |
Posted: Tue Jul 23, 2013 11:59 pm Post subject: |
|
|
Voyager
Joined: 01 Dec 2010 Posts: 76
|
Thanks..It really does not work.. |
|
Back to top |
|
 |
zpat |
Posted: Wed Jul 24, 2013 12:59 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Just remember that BST in WMB stands for Bangladeshi Standard Time.
-very strange, but true. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jul 24, 2013 8:45 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
This is one of the reasons why I only use Java for time zone conversion.
However as the SimpleDateFormat is not threadsafe you'd want to declare it as ThreadLocal...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|