Page 1 of 1

Transalate Total Months to number of Yrs and months

Posted: Tue Jun 09, 2009 2:34 pm
by janreddy
Hi,
I have the source column: Total_Life in Months and I would like to translate to Number of Years field and Remaining Months field.

Ex: Total_Life = 40 Months
Number of Years= 40/12=3.34 out of this I want only 3 (yrs)
Remaining Months=.34*12=4 Months approximately.

Basically I need to avoid decimals while getting year part and I need to consider the value after decimals for Months.

Could you help me with what function we may use in Datastage.

Thanks
Jana

Posted: Tue Jun 09, 2009 2:44 pm
by chulett
Do a Mod() of the total number of months by 12 to get any remaining months in the last partial year. And Floor() should work for the years part, I would think.