|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
DateTime Manipulation |
« View previous topic :: View next topic » |
Author |
Message
|
LH33 |
Posted: Mon Jan 06, 2003 12:03 pm Post subject: DateTime Manipulation |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
I am trying to take a DateTime field and add 48 hours to it. The format of the DateTime filed is : <YYYYMMDDHHMMSS>. What is the best way to strip off the date portion and then add 48 hours to it. I have tried Substring to get the date out and then adding 48 hours as follows: SET NEWDT = CURDT + INTERVAL '48' HOUR;
Thanks for any help!!!!
LisaB |
|
Back to top |
|
 |
kirani |
Posted: Mon Jan 06, 2003 7:59 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
First use SUBSTRING function to extract TIME part from Date Time field, then create a Time string in this format TIME 'HH:MM:SS.SEC' from it.
CAST this value as TIME and assign it to TIME variable. Finally, add INTERVAL '48' HOUR to TIME Variable to get new TIME. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
LH33 |
Posted: Tue Jan 07, 2003 10:26 am Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
Thank you for your help. I am still having some trouble. In trying to get this to work, I am at first just trying to SUBSTRING the DATE out and put that in the OutputRoot field. The XML coming in looks like:<2003-01-0202:20:22> and the XML going out gets transformed into: <2 1 2003> - it appears that the SUBSTRING works, but that it puts it in a different format. The ESQL reference giode says that the DATE data type is YYYY-MM-DD so I am confused as to why it comes out MM DD YYYY and strips off leading zeroes. My code is as follows:
DECLARE TRANSDATE DATE;
SET TRANSDATE = SUBSTRING(InputRoot.XML.CreateJob.DataArea.Job.TimeLine.CreationDateTime FROM 1 FOR 10);
SET OutputRoot.XML.CreateJob.DataArea.Job.TimeLine.EndBeforeDateTime = TRANSDATE;
I am also having trouble creating a Date string from it in order to add the interval. Do you have a code sample of that?
Thank you so much!! Lisa |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|