Converting date to Timestamp !!

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
its_me48
Participant
Posts: 33
Joined: Fri Apr 29, 2005 10:09 am

Converting date to Timestamp !!

Post by its_me48 »

Hello:

I get an external file that has "Record Date" as MM/DD/YYYY HH24:MM (11/19/2009 18:24) format.. The rows abort trying to load into oracle table due to the date/time format. In oracle that 'Record Date' is defined as Timestamp (YYYY-MM-DD HH24:MI:SS). Upon using search functionality here, I used Iconv/Oconv functions without any luck... I am home and cannot paste what I am doing...
Any pointers or code to help me convert the input column from "MM/DD/YYYY HH24:MI" to Oracle's "YYYY-MM-DD HH24:MI:SS" format is highly appreciated.

Thank You,
-Sam
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

For the date portion

Code: Select all

Oconv(Iconv(Left(InLink.Fieldname,10),"DMDY"),
"D-YMD[4,2,2]")
For the time portion

Code: Select all

Oconv(Iconv(Right(InLink.Fieldname, 5), "MT"),"MTS")
Concatenate these with a space between.

Code: Select all

Oconv(Iconv(Left(InLink.Fieldname,10),"DMDY"), "D-YMD[4,2,2]") : " " : Oconv(Iconv(Right(InLink.Fieldname, 5), "MT"),"MTS")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You could also just use the square bracket 'substring operators' to rearrange the date, then cat on the time and the zero seconds you'll need.
-craig

"You can never have too many knives" -- Logan Nine Fingers
its_me48
Participant
Posts: 33
Joined: Fri Apr 29, 2005 10:09 am

Post by its_me48 »

Ray and chulett,

Thanks much. Problem solved. Tried both ways.. BTW, I was not doing IConv right....

-Sam
Post Reply