Search code examples
etldatastageibm-infosphere

How to change 2 digit years into 4 digit year in Datastage?


Hello guys i wanted to asks , i have some problems with my source data Which is like first column is 01-Dec-18 and second column is 07-Jan-65

Which is the first column that i guess it should be 01-Dec-2018 because it can't be 1918 right? And the second column should be 07-Jan-1965

Well i can load it into DB but they read both of it becoming 01-Dec-1918 and 07-Jan-1965. What i wanted is 01-Dec-2018 and 07-Jan-1965

This is my code looks like :

StringToDate(DSLink3.OPN_DT,"%dd/%mmm/%yy")

Anyone has any clue about it ?


Solution

  • I suggest to do some string manipulations before you convert it to a date as it seems to be a string in your process.

    The hard thing here is not the substring and concatenation part but the business rule where to add a "19" or a "20" and this very much depends on your data.

    If you cannot have future dates you could compare the last two digits of the current year and add a "20" to everything equal or lower that and "19" to all others.