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 » Date calculation using IINTERVAL

Post new topic  Reply to topic
 Date calculation using IINTERVAL « View previous topic :: View next topic » 
Author Message
alokamit72
PostPosted: Mon Jul 06, 2015 6:09 am    Post subject: Date calculation using IINTERVAL Reply with quote

Newbie

Joined: 02 Jun 2011
Posts: 8

I am calculating time using INTERVAL like below

DECLARE dateStr1 CHARACTER '2015-07-30';
DECLARE MSGDATE1 TIMESTAMP;
SET MSGDATE1 = CAST(dateStr1 AS TIMESTAMP FORMAT 'yyyy-MM-dd');
SET Environment.Variables.Dates.CAQHEndDate1 = MSGDATE1 + CAST(11 AS INTERVAL MONTH);
in this case its working fine output is '2016-06-30'

But once i am changing the date to 31 like
DECLARE dateStr1 CHARACTER '2015-07-31';
still its giving '2016-06-30'.

Code is not working for month '2015-07-31'.

can anyone help me on this.

Thanks
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Jul 06, 2015 6:22 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Stupid thing to try - just to see what it does.

Start at 7-30 and then add 11 months and a day.

Also try other months with 31 days.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jul 06, 2015 6:30 am    Post subject: Re: Date calculation using IINTERVAL Reply with quote

Grand High Poobah

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

alokamit72 wrote:
But once i am changing the date to 31 like
DECLARE dateStr1 CHARACTER '2015-07-31';
still its giving '2016-06-30'.


What were you expecting? 2016-06-31?

If you were, stop and think of why that didn't happen. Hint - nothing to do with code and everything to do with the Gregorian calendar.

If you were expecting 2016-07-01, then that's not what you've coded. If you're not happy with the software's inbuilt handling of days 29 - 31 (imagine if your start date was 2015-03-30) then you need to code something else.
_________________
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 Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Date calculation using IINTERVAL
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.