Author |
Message
|
prakash27 |
Posted: Fri Aug 26, 2011 8:46 am Post subject: Convert GMT to CST |
|
|
Novice
Joined: 15 Feb 2011 Posts: 20
|
Just wondering how to convert a GMT Timestamp to CST timestamp considering daylight savings.
My Env: WMB61 AIX |
|
Back to top |
|
 |
Vitor |
Posted: Fri Aug 26, 2011 8:50 am Post subject: Re: Convert GMT to CST |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
prakash27 wrote: |
Just wondering how to convert a GMT Timestamp to CST timestamp considering daylight savings. |
You could start with this.
Or better still, start with the search facility on the InfoCenter.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
prakash27 |
Posted: Fri Aug 26, 2011 9:04 am Post subject: Convert GMT to CST |
|
|
Novice
Joined: 15 Feb 2011 Posts: 20
|
Thanks Vitor for quick response.
INTERVAL command shouldn't work in my case since it doesn't take any parameters.
My scenario is: Application will send GMT timestamp like 2011-08-31T22:39:51Z. This needs to be converted to CST by WMB.
Thanks |
|
Back to top |
|
 |
Vitor |
Posted: Fri Aug 26, 2011 9:11 am Post subject: Re: Convert GMT to CST |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
prakash27 wrote: |
INTERVAL command shouldn't work in my case since it doesn't take any parameters. |
It shouldn't work in your case, and won't work in any one else's, because INTERVAL isn't a command.
prakash27 wrote: |
My scenario is: Application will send GMT timestamp like 2011-08-31T22:39:51Z. This needs to be converted to CST by WMB. |
Yes, I did understand that. And I stand by my previous post. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Fri Aug 26, 2011 9:18 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
I disagree with your requirement to convert timestamp from GMT to CST. All computational times should only be represented as GMT, except when displayed to a user, through a user interface. Since WMB never displays time information to a user, there is no requirement to convert between timezones. (ie. WMB is not a user interface). _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Vitor |
Posted: Fri Aug 26, 2011 9:54 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
lancelotlinc wrote: |
All computational times should only be represented as GMT, except when displayed to a user, through a user interface. |
I took the view that the local time was being so presented; the output from WMB being taken without further processing to a screen or print output.
Clearly just an assumption. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
smdavies99 |
Posted: Fri Aug 26, 2011 10:07 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
The OP hasn't said which CST he is talking about.
I seem to remember a previous question on this very topic.
http://www.worldtimezone.com/wtz-names/wtz-cst.html
Indicates that there are at least TWO places in the world that use CST as its Timezone. _________________ 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 |
|
 |
lancelotlinc |
Posted: Fri Aug 26, 2011 10:08 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
http://www.w3.org/TR/timezone/
What is the purpose of a timestamp?
Quote: |
If your application can accurately generate incremental and/or field-based times based on UTC and the events are not tied to specific local time, all that is needed is the timestamp value itself. That is, if your application never needs to recover what the actual wall time was when event occurred and only cares about relative ordering of events. |
Why is the timezone not relevant in timestamps?
Quote: |
In fact, it is often desirable to normalize time values to UTC (or a specific UTC offset) so that separate series of data can be easily compared and merged. Information about local offset may be valuable in recovering the actual wall time, but time zone rules are probably only rarely interesting. |
W3C Best Practice:
Quote: |
When creating content, use UTC for your time values whenever possible so that values from discrete sources can be compared more readily. |
_________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Vitor |
Posted: Fri Aug 26, 2011 10:15 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
smdavies99 wrote: |
Indicates that there are at least TWO places in the world that use CST as its Timezone. |
Quite. I was sticking to the principle of timezone adjustment. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Aug 26, 2011 10:19 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
lancelotlinc wrote: |
http://www.w3.org/TR/timezone/
What is the purpose of a timestamp?
Quote: |
If your application can accurately generate incremental and/or field-based times based on UTC and the events are not tied to specific local time, all that is needed is the timestamp value itself. That is, if your application never needs to recover what the actual wall time was when event occurred and only cares about relative ordering of events. |
|
Quite true. And irrelevant to many humans, who want to look at broker output without further automated mediation.
lancelotlinc wrote: |
Why is the timezone not relevant in timestamps?
Quote: |
In fact, it is often desirable to normalize time values to UTC (or a specific UTC offset) so that separate series of data can be easily compared and merged. Information about local offset may be valuable in recovering the actual wall time, but time zone rules are probably only rarely interesting. |
|
Still true, and as I attempted to indicate it's down to the individual (the OP in this instance) to determine the actual offset required (given which CST is meant). Comment above regarding humans repeated.
lancelotlinc wrote: |
W3C Best Practice:
Quote: |
When creating content, use UTC for your time values whenever possible so that values from discrete sources can be compared more readily. |
|
The OP is not creating content, but interpreting it. The point of this thread is that someone has followed this practice and provided a timestamp in UTC. So your response is tautological at best. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Fri Aug 26, 2011 10:23 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Thank you for the complements, Sir Vitor, .... I think. I'm going to have to get my Merriam Webster 1847 dictionary out for 'tautological'. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Aug 26, 2011 1:54 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
lancelotlinc wrote: |
Thank you for the complements, Sir Vitor, .... I think. I'm going to have to get my Merriam Webster 1847 dictionary out for 'tautological'. |
http://en.wikipedia.org/wiki/Tautology_%28rhetoric%29
is a quite good explanation...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rekarm01 |
Posted: Sun Aug 28, 2011 5:32 pm Post subject: Re: Convert GMT to CST |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
prakash27 wrote: |
Just wondering how to convert a GMT Timestamp to CST timestamp considering daylight savings. |
Considering Daylight saving time, shouldn't that be CDT? The XSD dateTime type can only represent time zone offsets (like "Z" or "-05:00"), but not time zone identifiers (like "UTC" or "CDT"). Applications would need to keep track of the time zone IDs separately.
ESQL currently offers little support for specifying time zone offsets upon output; an external Java method may work better.
lancelotlinc wrote: |
I disagree with your requirement ... |
That seems a bit imperious.
lancelotlinc wrote: |
All computational times should only be represented as GMT, except when displayed to a user, through a user interface. Since WMB never displays time information to a user, there is no requirement to convert between timezones. (ie. WMB is not a user interface). |
Nonsense. The WMB transforms data for other applications, including user interfaces. Why shouldn't it transform time zones within timestamps for them, as well?
lancelotlinc wrote: |
What is the purpose of a timestamp?
Quote: |
If your application can accurately generate incremental and/or field-based times based on UTC and the events are not tied to specific local time, all that is needed is the timestamp value itself. That is, if your application never needs to recover what the actual wall time was when event occurred and only cares about relative ordering of events. |
|
lancelotlinc wrote: |
Why is the timezone not relevant in timestamps?
Quote: |
In fact, it is often desirable to normalize time values to UTC (or a specific UTC offset) so that separate series of data can be easily compared and merged. Information about local offset may be valuable in recovering the actual wall time, but time zone rules are probably only rarely interesting. |
|
These excerpts merely state that some applications only care about the order of events, so those applications don't need to convert timestamps to local time. But they don't address the OP's scenario; they don't even address the questions propped in front of them. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Aug 28, 2011 7:33 pm Post subject: Re: Convert GMT to CST |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
prakash27 wrote: |
Just wondering how to convert a GMT Timestamp to CST timestamp considering daylight savings.
My Env: WMB61 AIX |
I would suggest you use a Java function for this (relatively easy to do). Main reason is that AFAIK the broker will only use the current offset from GMT and not the offset at the time of the timestamp (implying differences due to DST).
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
prakash27 |
Posted: Mon Aug 29, 2011 10:23 am Post subject: Convert GMT to CST |
|
|
Novice
Joined: 15 Feb 2011 Posts: 20
|
Thank you all for your support and suggestions.
Below statement converted GMT timestamp to Local timestamp.
CAST(InputRoot.XMLNSC.GMTDate AS TIMESTAMP FORMAT 'IU')
Thanks. |
|
Back to top |
|
 |
|