Calc between dates

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Marcelo
Participant
Posts: 7
Joined: Mon Dec 22, 2003 8:14 am

Calc between dates

Post by Marcelo »

Hi,

I trying to calculate diference between 2 dates (dt born and dt die).
I need months and days.
Can someone help me?

tks
Marcelo
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Search this forum, there are a lot of examples and code posted.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
phanee_k
Charter Member
Charter Member
Posts: 68
Joined: Thu Nov 20, 2003 11:02 pm

Post by phanee_k »

You can find the difference by using Iconv and OConv Functions in datastage.Please go through the help for the same.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

To expand on this just a little, use Iconv to convert a date into 'internal' format. Once you have two dates in internal format, simple subtraction would give you the diffence between them in days... then you take it from there.

Of course, this depends on what you mean by 'months'. If a month is a generic block of 30 days (for instance) this will be very simple to derive. Do you need the actual months between the two dates? I'd guess in that case you'd need to create some sort of iterative approach that works its way from one date to the other, counting as it goes. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply