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 » DateTime Manipulation

Post new topic  Reply to topic
 DateTime Manipulation « View previous topic :: View next topic » 
Author Message
LH33
PostPosted: Mon Jan 06, 2003 12:03 pm    Post subject: DateTime Manipulation Reply with quote

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
View user's profile Send private message
kirani
PostPosted: Mon Jan 06, 2003 7:59 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
LH33
PostPosted: Tue Jan 07, 2003 10:26 am    Post subject: Reply with quote

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
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 » DateTime Manipulation
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.