Author |
Message
|
soudhanya |
Posted: Thu Jul 27, 2017 10:03 am Post subject: Timezone in ESQL |
|
|
Novice
Joined: 27 Feb 2017 Posts: 20
|
How to set timezone in ESQL like below java code?
Code: |
if(n.getAttributes().getNamedItem("IntervalZone").getNodeValue().equals("MountainUS")){
inSDF.setTimeZone(TimeZone.getTimeZone("US/Mountain"));
outSDF.setTimeZone(TimeZone.getTimeZone("US/Mountain"));
timeZone="MT";
}
//else if(n.getAttributes().getNamedItem("IntervalZone").getNodeValue().equals("MountainUSStandard")){
else if(n.getAttributes().getNamedItem("IntervalZone").getNodeValue().equals("MountainUSNoDst")){
inSDF.setTimeZone(TimeZone.getTimeZone("GMT-7:00"));
outSDF.setTimeZone(TimeZone.getTimeZone("GMT-7:00"));
timeZone="MST";
} |
|
|
Back to top |
|
 |
Vitor |
Posted: Thu Jul 27, 2017 10:33 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
You don't - ESQL doesn't work that way.
I'm surprised you need to do that in Java, but then I'm often surprised about Java. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Jul 27, 2017 8:56 pm Post subject: Re: Timezone in ESQL |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
soudhanya wrote: |
How to set timezone in ESQL like below java code?
Code: |
if(n.getAttributes().getNamedItem("IntervalZone").getNodeValue().equals("MountainUS")){
inSDF.setTimeZone(TimeZone.getTimeZone("US/Mountain"));
outSDF.setTimeZone(TimeZone.getTimeZone("US/Mountain"));
timeZone="MT";
}
//else if(n.getAttributes().getNamedItem("IntervalZone").getNodeValue().equals("MountainUSStandard")){
else if(n.getAttributes().getNamedItem("IntervalZone").getNodeValue().equals("MountainUSNoDst")){
inSDF.setTimeZone(TimeZone.getTimeZone("GMT-7:00"));
outSDF.setTimeZone(TimeZone.getTimeZone("GMT-7:00"));
timeZone="MST";
} |
|
Sorry but I have to question if you're doing the right thing here.
The interval is an absolute value difference between 2 time moments.
Looking at Java it should always be expressed in GMT as the effective value for the timestamp (long) is always represented in GMT.
Now displaying a moment + an interval, you may want to display the resulting moment in the same time zone as the originating moment....
But be assured that we are talking about display here and that should be a function of the application. As far as the ESB and the storage / messaging of the data, all time data should be recorded in GMT.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
timber |
Posted: Fri Jul 28, 2017 3:15 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Quote: |
As far as the ESB and the storage / messaging of the data, all time data should be recorded in GMT. |
I agree. I suggest that you review the requirements and ask why this is being requested. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jul 28, 2017 5:03 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
timber wrote: |
Quote: |
As far as the ESB and the storage / messaging of the data, all time data should be recorded in GMT. |
I agree. I suggest that you review the requirements and ask why this is being requested. |
Oh good - I was wondering what the heck was going on here and assumed it was some kind of weird Java thing.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|