If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > DateDiff help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-29-11, 06:46
bgreer2710 bgreer2710 is offline
Registered User
 
Join Date: Nov 2011
Posts: 4
DateDiff help

Good morning,

I have a query where I pull a Julian date from a database: MYDATE
Then get TodaysDate using (current date)

SELECT MYDATE, (current date) As TodaysDate FROM LIBRARY.FILE

I need to get the difference of the two in days. How would I do it in my SELECT statement ?

I can convert the Julian date (MYDATE) to a date or a string that represents a date.....to be honest I am not sure what is being returned, but I use a Date Translation File to get it. My Date translation file has a FIELD TYPE of A.

It's obvious I am new to DB2. Please help a Newbie

Thanks
Reply With Quote
  #2 (permalink)  
Old 11-29-11, 07:42
bgreer2710 bgreer2710 is offline
Registered User
 
Join Date: Nov 2011
Posts: 4
DateDiff help - update

My Date Translation file is returning the date in a format like this:

09/10/11

If I can convert 09/10/11 into a format like this 09/10/2011 then I can make it work. How can I make this conversion ?

Thanks
Reply With Quote
  #3 (permalink)  
Old 11-29-11, 09:25
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
What is the data type of MYDATE? What DB2 version and OS are you using?

Andy
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On