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 » convert years, months to days

Post new topic  Reply to topic
 convert years, months to days « View previous topic :: View next topic » 
Author Message
sunny_30
PostPosted: Thu Feb 27, 2014 2:56 pm    Post subject: convert years, months to days Reply with quote

Master

Joined: 03 Oct 2005
Posts: 258

Is there a way to convert Years, Months to Days in esql ?

Im using INTERVAL datatype to store the # of Years and Months but Im trying to figure how to convert that to days.

I have a requirement to convert XML schema Duration datatype: PnYnMnDTnHnMnS to HHmmss.
I have the StartDateTime in this format: 'yyyy-MM-dd''T''HH:mm:ssZ'
Back to top
View user's profile Send private message
Simbu
PostPosted: Thu Feb 27, 2014 8:32 pm    Post subject: Reply with quote

Master

Joined: 17 Jun 2011
Posts: 289
Location: Tamil Nadu, India

Have you tried EXTRACT Fn?
Back to top
View user's profile Send private message
santhoshramesh
PostPosted: Thu Feb 27, 2014 10:59 pm    Post subject: Reply with quote

Novice

Joined: 26 Feb 2014
Posts: 17

As Mr. Simbu said, try Extract function
Sample:
EXTRACT(DAY FROM Source Date)
Back to top
View user's profile Send private message
Gralgrathor
PostPosted: Fri Feb 28, 2014 1:05 am    Post subject: Reply with quote

Master

Joined: 23 Jul 2009
Posts: 297

santhoshramesh wrote:
EXTRACT(DAY FROM Source Date)


Uh uh.

http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/topic/com.ibm.etools.mft.doc/ak05420_.htm?resultof=%22extract%22 wrote:
EXTRACT(DAY FROM CURRENT_TIME)

fails.

EXTRACT (DAYS FROM DATE '2000-02-29')

calculates the number of days encountered since year 1 to '2000-02-29' and

EXTRACT (DAYOFYEAR FROM CURRENT_DATE)

calculates the number of days encountered since the beginning of the current year but

_________________
A measure of wheat for a penny, and three measures of barley for a penny; and see thou hurt not the oil and the wine.
Back to top
View user's profile Send private message Send e-mail
sunny_30
PostPosted: Fri Feb 28, 2014 6:28 am    Post subject: Reply with quote

Master

Joined: 03 Oct 2005
Posts: 258

I got it working. Thx for help

My requirement is to calculate 'Hours' elapsed ([Hours]mmss format) since a particular startDate ('yyyy-MM-dd''T''HH:mm:ssZ') till PnYnMnDTnHnMnS period. To convert duration of 'years, months' to exact Days requires a start-date.

I created an INTERVAL variable and stored Years, Months in 'YEAR TO MONTH' subtype. later added this to start-date-Timestamp (ts1) which results in another Timestamp (ts2)

Another INTERVAL variable to store (ts2 - ts1) HOUR results in # of Hours

Thanks
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 » convert years, months to days
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.