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 » Timezone Conversion

Post new topic  Reply to topic Goto page 1, 2  Next
 Timezone Conversion « View previous topic :: View next topic » 
Author Message
Sneh4nsu
PostPosted: Mon Aug 21, 2017 11:31 pm    Post subject: Timezone Conversion Reply with quote

Novice

Joined: 11 Aug 2017
Posts: 12

Code:
InputRoot.Properties.CreationTime

This is coming as GMT timestamp. I need to convert it to timezone same as CURRENT_TIMESTAMP
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Aug 22, 2017 5:10 am    Post subject: Re: Timezone Conversion Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Sneh4nsu wrote:
Code:
InputRoot.Properties.CreationTime

This is coming as GMT timestamp. I need to convert it to timezone same as CURRENT_TIMESTAMP


Congratulations. Is there a question?

Assuming a question of "how do I do this", you apply the difference in time zone (typically expressed as a number of hours) between your current time zone and GMT.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Aug 22, 2017 6:07 am    Post subject: Re: Timezone Conversion Reply with quote

Grand High Poobah

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

Vitor wrote:
Sneh4nsu wrote:
Code:
InputRoot.Properties.CreationTime

This is coming as GMT timestamp. I need to convert it to timezone same as CURRENT_TIMESTAMP


Congratulations. Is there a question?

Assuming a question of "how do I do this", you apply the difference in time zone (typically expressed as a number of hours) between your current time zone and GMT.

I thought you could cast from GMT_TIMESTAMP to CURRENT_TIMESTAMP and vice versa??
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Tue Aug 22, 2017 6:09 am    Post subject: Re: Timezone Conversion Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

fjb_saper wrote:
Vitor wrote:
Sneh4nsu wrote:
Code:
InputRoot.Properties.CreationTime

This is coming as GMT timestamp. I need to convert it to timezone same as CURRENT_TIMESTAMP


Congratulations. Is there a question?

Assuming a question of "how do I do this", you apply the difference in time zone (typically expressed as a number of hours) between your current time zone and GMT.

I thought you could cast from GMT_TIMESTAMP to CURRENT_TIMESTAMP and vice versa??


I left how you'd apply the difference as an exercise for the reader. Thought a little brain cell exertion would be beneficial.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
timber
PostPosted: Tue Aug 22, 2017 12:38 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

Quote:
I thought you could cast from GMT_TIMESTAMP to CURRENT_TIMESTAMP and vice versa
No, you can only CAST from one type to another type. GMT_TIMESTAMP and CURRENT_TIMESTAMP are ESQL functions.

But your point stands - ESQL contains loads of functions for manipulating dates and times. The OP should read the ESQL reference in the IIB Knowledge Center and come back with questions after that.
Back to top
View user's profile Send private message
Sneh4nsu
PostPosted: Tue Aug 22, 2017 11:21 pm    Post subject: Re: Timezone Conversion Reply with quote

Novice

Joined: 11 Aug 2017
Posts: 12

Vitor wrote:
fjb_saper wrote:
Vitor wrote:
Sneh4nsu wrote:
Code:
InputRoot.Properties.CreationTime

This is coming as GMT timestamp. I need to convert it to timezone same as CURRENT_TIMESTAMP


Congratulations. Is there a question?

Assuming a question of "how do I do this", you apply the difference in time zone (typically expressed as a number of hours) between your current time zone and GMT.

I thought you could cast from GMT_TIMESTAMP to CURRENT_TIMESTAMP and vice versa??


I left how you'd apply the difference as an exercise for the reader. Thought a little brain cell exertion would be beneficial.


Timezone for
Code:
InputRoot.Properties.CreationTime
is coming as GMT but when You set the value for a variable as CURRENT_TIMESTAMP its generating broker time whose timezone is not same as GMT. In my case Im getting the following values
InputRoot.Properties.CreationTime as 18-AUG-17 11.03.00.190000000 AM
CURRENT_TIMESTAMP as 18-AUG-17 04.40.37.422458000 AM
Since the code will be deployed in different environment i cannot change simply by ''apply difference in timezone" rather I need to change InputRoot.Properties.CreationTime to broker timezone.
Now my QUESTION is how to do that??
Back to top
View user's profile Send private message
adubya
PostPosted: Wed Aug 23, 2017 12:37 am    Post subject: Reply with quote

Partisan

Joined: 25 Aug 2011
Posts: 377
Location: GU12, UK

This function may be of some use to you

https://www.ibm.com/support/knowledgecenter/en/SSMKHH_10.0.0/com.ibm.etools.mft.doc/ak05490_.htm


I'll leave the implementation as an exercise for the reader.
_________________
Independent Middleware Consultant
andy@knownentity.com
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Wed Aug 23, 2017 2:08 am    Post subject: Reply with quote

Grand High Poobah

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

Maybe you should use CURRENT_GMTTIMESTAMP. This way you can display it in any time zone after the fact...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Wed Aug 23, 2017 6:07 am    Post subject: Re: Timezone Conversion Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Sneh4nsu wrote:
Since the code will be deployed in different environment i cannot change simply by ''apply difference in timezone" rather I need to change InputRoot.Properties.CreationTime to broker timezone.


Why not? You can programmatically determine the time zone of this "different environment"
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Aug 23, 2017 6:08 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

adubya wrote:
This function may be of some use to you

https://www.ibm.com/support/knowledgecenter/en/SSMKHH_10.0.0/com.ibm.etools.mft.doc/ak05490_.htm


I'll leave the implementation as an exercise for the reader.



_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Sneh4nsu
PostPosted: Wed Aug 23, 2017 9:52 am    Post subject: Reply with quote

Novice

Joined: 11 Aug 2017
Posts: 12

adubya wrote:
This function may be of some use to you

https://www.ibm.com/support/knowledgecenter/en/SSMKHH_10.0.0/com.ibm.etools.mft.doc/ak05490_.htm


I'll leave the implementation as an exercise for the reader.

Code:
DECLARE Cur INTERVAL LOCAL_TIMEZONE;

every time the debugger checks this line in the debugging mode it gets hanged ( nothing in the variables section).
I am posting a screenshot of a demo application over here since posting anything of the actual project will be against company's security protocol
[img]https://ibb.co/iDXScQ[/img]
What am I supposed to do??
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Aug 23, 2017 9:56 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Well.

If the debugger hangs, then stop using the debugger.

Use trace nodes and user trace. *Much* more reliable and accurate.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Aug 23, 2017 11:05 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Sneh4nsu wrote:
Code:
DECLARE Cur INTERVAL LOCAL_TIMEZONE;


What am I supposed to do??


Following the advice of my most worthy associate is a good idea.

I've also got to wonder what this line is supposed to achieve. Exactly how much manipulation do you plan to do to the local time zone interval? Under most circumstances it's the value you want from the off.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Sneh4nsu
PostPosted: Wed Aug 23, 2017 11:46 am    Post subject: Re: Timezone Conversion Reply with quote

Novice

Joined: 11 Aug 2017
Posts: 12

Vitor wrote:
fjb_saper wrote:
Vitor wrote:
Sneh4nsu wrote:
Code:
InputRoot.Properties.CreationTime

This is coming as GMT timestamp. I need to convert it to timezone same as CURRENT_TIMESTAMP


Congratulations. Is there a question?

Assuming a question of "how do I do this", you apply the difference in time zone (typically expressed as a number of hours) between your current time zone and GMT.

I thought you could cast from GMT_TIMESTAMP to CURRENT_TIMESTAMP and vice versa??


I left how you'd apply the difference as an exercise for the reader. Thought a little brain cell exertion would be beneficial.


SOLVED!!!
Code:
DECLARE putTime TIMESTAMP;
   SET putTime = InRefProp.CreationTime + INTERVAL '0' HOUR;

This will convert InputRoot.Properties.CreationTime from GMT to local time zone.
thanks everyone!!
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Aug 23, 2017 12:13 pm    Post subject: Re: Timezone Conversion Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Sneh4nsu wrote:

SOLVED!!!
Code:
DECLARE putTime TIMESTAMP;
   SET putTime = InRefProp.CreationTime + INTERVAL '0' HOUR;

This will convert InputRoot.Properties.CreationTime from GMT to local time zone.
thanks everyone!!


I have no idea how that could work unless your local time zone was aligned with GMT.

But if it meets your requirements, then it's a win so go in peace.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Timezone Conversion
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.