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 » How to get Timestamp in CET thru ESQL

Post new topic  Reply to topic
 How to get Timestamp in CET thru ESQL « View previous topic :: View next topic » 
Author Message
maven
PostPosted: Mon May 18, 2009 12:32 am    Post subject: How to get Timestamp in CET thru ESQL Reply with quote

Novice

Joined: 03 Jun 2007
Posts: 15

Hey,

I need to set timestamp in CET in the MQMD. I can find that only localtime or gmt time can be set thru esql function. Is there any esql function or a way to set CET timestamp, taking into considering the daylight saving. The server is in US.

Im planning to code something like below,
SET Diff = EXTRACT( HOUR from (CURRENT_GMTTIMESTAMP - CURRENT_TIMESTAMP);
SET TineZone = CASE Diff
WHEN 7 THEN 'set PutTime = CURRENT_TIME + CAST(5 AS INTERVAL HOUR);'
WHEN 8 THEN 'set PutTime = CURRENT_TIME + CAST(6 AS INTERVAL HOUR);'
WHEN -17 THEN 'set PutTime = ...'
'set PutDate = CURRENT_DATE + CAST(1 AS INTERVAL DAY)'
WHEN -18 THEN 'set PutTime = ...'
'set PutDate = ...'
END;

Im using MB v6.1.0.3
Let me know if there is any other suggestion.
Back to top
View user's profile Send private message
MQEnthu
PostPosted: Mon May 18, 2009 12:48 am    Post subject: Reply with quote

Partisan

Joined: 06 Oct 2008
Posts: 329
Location: India

Did you check this one??

http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/topic/com.ibm.etools.mft.doc/ak05490_.htm
_________________
-----------------------------------------------
It is good to remember the past,
but don't let past capture your future
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon May 18, 2009 12:51 am    Post subject: Reply with quote

Grand High Poobah

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

MQEnthu wrote:
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/topic/com.ibm.etools.mft.doc/ak05490_.htm


I think the poster's point is that CET is not local to the server he's using, but is local to him.
_________________
Honesty is the best policy.
Insanity is the best defence.


Last edited by Vitor on Mon May 18, 2009 1:04 am; edited 1 time in total
Back to top
View user's profile Send private message
MQEnthu
PostPosted: Mon May 18, 2009 12:57 am    Post subject: Reply with quote

Partisan

Joined: 06 Oct 2008
Posts: 329
Location: India

Vitor wrote:
...CET is not local to the server he's using, but is local to him


maven wrote:
...The server is in US.



_________________
-----------------------------------------------
It is good to remember the past,
but don't let past capture your future
Back to top
View user's profile Send private message
maven
PostPosted: Mon May 18, 2009 6:27 am    Post subject: Reply with quote

Novice

Joined: 03 Jun 2007
Posts: 15

hi MQEnthu n Vitor,
I had checked for the 'LOCAL_TIMEZONE' function. But it gives the difference between local time and GMT.

Also CET is not local. Since the server on which the boker is installed is in US and we want to set CET time for all our message since our applications in europe cant be modified to use GMT or PST.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon May 18, 2009 6:31 am    Post subject: Reply with quote

Grand High Poobah

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

maven wrote:
Also CET is not local. Since the server on which the boker is installed is in US and we want to set CET time for all our message since our applications in europe cant be modified to use GMT or PST.


My point exactly.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
rekarm01
PostPosted: Tue May 19, 2009 11:51 pm    Post subject: Re: How to get Timestamp in CET thru ESQL Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

maven wrote:
I need to set timestamp in CET in the MQMD.

Although applications could privately agree to use something other than GMT in the MQMD PutDate/PutTime fields, it's not a good practice.

maven wrote:
Is there any esql function or a way to set CET timestamp, taking into considering the daylight saving.

No.

maven wrote:
I'm planning to code something like below
Code:

SET Diff = EXTRACT( HOUR from (CURRENT_GMTTIMESTAMP - CURRENT_TIMESTAMP);
SET TineZone = CASE Diff
 WHEN 7 THEN 'set PutTime = CURRENT_TIME + CAST(5 AS INTERVAL HOUR);'
 WHEN 8 THEN 'set PutTime = CURRENT_TIME + CAST(6 AS INTERVAL HOUR);'
 WHEN -17 THEN 'set PutTime = ...'
            'set PutDate = CURRENT_DATE + CAST(1 AS INTERVAL DAY)'
 WHEN -18 THEN 'set PutTime = ...'
            'set PutDate = ...'
END;

Just a few problems so far:
  • ESQL casts operands of (CURRENT_GMTTIMESTAMP - CURRENT_TIMESTAMP) to the same type before substracting, returning INTERVAL 0 HOUR; the LOCAL_TIMEZONE function would work better
  • some of the other numbers are a bit off
  • DST may have started/ended between the message put time and the current time
  • the US and Europe don't start or end DST at the same time, the same day, or even the same week, so the difference between local time and CET/CEST is not constant; deriving CET/CEST time from local time would be ... difficult

Here are some other options:
  • check again whether the applications in Europe really, really can't accept GMT PutDates/PutTimes
  • use Java to calculate CET/CEST timestamps; java.util.Calendar is a good place to start
  • set the broker's (or server's) local timezone to CET/CEST, so the ESQL local time functions will work as desired; the broker need not use the same timezone as the underlying OS, (though that might present some other challenges)
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed May 20, 2009 12:32 pm    Post subject: Reply with quote

Grand High Poobah

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

maven wrote:
I need to set timestamp in CET in the MQMD. I can find that only localtime or gmt time can be set thru esql function. Is there any esql function or a way to set CET timestamp, taking into considering the daylight saving. The server is in US.

This is entirely the wrong approach.
MQ writes the timestamp to the MQMD as a GMTTIMESTAMP worldwide.
If you need to display it in CET this is easily done with a number of functions some of which are easily available in Java (Calendar, SimpleDateFormater, TimeZone, Locale...).

This is a display problem. The timestamp on the message's MQMD is always in GMT and you should keep it so. It makes calculations real easy. How you display the result is then a completely different thing...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to get Timestamp in CET thru ESQL
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.