Author |
Message
|
Sneh4nsu |
Posted: Mon Aug 21, 2017 11:31 pm Post subject: Timezone Conversion |
|
|
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 |
|
 |
Vitor |
Posted: Tue Aug 22, 2017 5:10 am Post subject: Re: Timezone Conversion |
|
|
 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 |
|
 |
fjb_saper |
Posted: Tue Aug 22, 2017 6:07 am Post subject: Re: Timezone Conversion |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 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 |
|
 |
Vitor |
Posted: Tue Aug 22, 2017 6:09 am Post subject: Re: Timezone Conversion |
|
|
 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 |
|
 |
timber |
Posted: Tue Aug 22, 2017 12:38 pm Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
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 |
|
 |
Sneh4nsu |
Posted: Tue Aug 22, 2017 11:21 pm Post subject: Re: Timezone Conversion |
|
|
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 |
|
 |
adubya |
Posted: Wed Aug 23, 2017 12:37 am Post subject: |
|
|
Partisan
Joined: 25 Aug 2011 Posts: 377 Location: GU12, UK
|
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Aug 23, 2017 2:08 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 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 |
|
 |
Vitor |
Posted: Wed Aug 23, 2017 6:07 am Post subject: Re: Timezone Conversion |
|
|
 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 |
|
 |
Vitor |
Posted: Wed Aug 23, 2017 6:08 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
 _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Sneh4nsu |
Posted: Wed Aug 23, 2017 9:52 am Post subject: |
|
|
Novice
Joined: 11 Aug 2017 Posts: 12
|
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 |
|
 |
mqjeff |
Posted: Wed Aug 23, 2017 9:56 am Post subject: |
|
|
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 |
|
 |
Vitor |
Posted: Wed Aug 23, 2017 11:05 am Post subject: |
|
|
 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 |
|
 |
Sneh4nsu |
Posted: Wed Aug 23, 2017 11:46 am Post subject: Re: Timezone Conversion |
|
|
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 |
|
 |
Vitor |
Posted: Wed Aug 23, 2017 12:13 pm Post subject: Re: Timezone Conversion |
|
|
 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 |
|
 |
|