How to Convert from DD-MM-YYYY hh24:mi:ss to YYYY-MM-DD hh24

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
moose2079
Premium Member
Premium Member
Posts: 48
Joined: Tue Mar 07, 2006 4:52 pm
Location: Australia

How to Convert from DD-MM-YYYY hh24:mi:ss to YYYY-MM-DD hh24

Post by moose2079 »

I have a source Varchar(38) field in a sequential file that I want to load to an Oracle DataBase target column (using a Bulk Loader) - the target field is a TimeStamp
How do I Convert from DD-MM-YYYY hh24:mi:ss to YYYY-MM-DD hh24 Using oConv(iConv ???? Please advise

:-)

Michael Mills
YUM
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Because there are no internal data types in server jobs, you could simply re-arrange the substrings.
Otherwise, you need to convert the date and time portions separately and concatenate them with a separating space character. Because it's Oracle, I suspect you'll need minutes and seconds too - if not, leave out the ":00:00" string.

Code: Select all

Oconv(Iconv(Field(InLink.TheTimestamp," ",1,1),"DDMY"),"D-YMD[4,2,2]") : " " : Left(Field(InLink.TheTimestamp," ",2,1),2) : ":00:00"
Last edited by ray.wurlod on Wed May 16, 2007 12:48 am, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
baglasumit21
Participant
Posts: 132
Joined: Wed Mar 01, 2006 11:12 pm
Location: Pune

Re: How to Convert from DD-MM-YYYY hh24:mi:ss to YYYY-MM-DD

Post by baglasumit21 »

moose2079 wrote:I have a source Varchar(38) field in a sequential file that I want to load to an Oracle DataBase target column (using a Bulk Loader) - the target field is a TimeStamp
How do I Convert from DD-MM-YYYY hh24:mi:ss to YYYY-MM-DD hh24 Using oConv(iConv ???? Please advise

:-)

Michael Mills
I think a better option is to use sub-string and rearrange the date.
SMB
Post Reply