Data conversion

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Narayana
Participant
Posts: 16
Joined: Fri Mar 30, 2007 9:25 am

Data conversion

Post by Narayana »

Hi,

I am trying to convert a character date, format:

MM/DD/YY

to a date, format:

DD/MM/YYYY

In Server Edition, this was easily taken care of using oconv, but now tht we are moving onto EE, I am having difficulty. I tried the following:

DateToString(StringToDate(Trim(lkDatesStripped.DataOut), "%mm/%dd/%yy"), "%dd/%mm/%yyyy")

This however took input 02/11/07 and converted to 11/02/1907!

Any suggestions please.

Thanks
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

Try this.

Code: Select all

DateToString(StringToDate(Trim(lkDatesStripped.DataOut), "%mm/%dd/%yy"), "%dd/%mm/%2000yy") 
or

Set APT_DATE_CENTURY_BREAK_YEAR environment variable to 2000.
Narayana
Participant
Posts: 16
Joined: Fri Mar 30, 2007 9:25 am

Post by Narayana »

But I do get the Data of '97 so if i am derivation as provided.. it iwill again give me the wrong output even if i set the Env variable to 2000.

Thanks for your reply
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

Narayana wrote:But I do get the Data of '97 so if i am derivation as provided.. it iwill again give me the wrong output even if i set the Env variable to 2000.

Thanks for your reply
What happens if you specify as below:

Code: Select all

DateToString(StringToDate(Trim(lkDatesStripped.DataOut), "%mm/%dd/%yy"), "%dd/%mm/%1950yy") 
If it works replace 1950 with any number you like.
Post Reply