how to convert format 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
pxraja
Participant
Posts: 142
Joined: Fri Mar 14, 2008 10:22 am

how to convert format timestamp

Post by pxraja »

Hi All,

how to convert timestamp format

Inlink.Field1
2008-09-06 20.30.156546

Outlink.Field1
2008-09-06 08:30:15 PM


I had tried using Iconv and Oconv like..

Oconv(Iconv(Inlink.Field1,'D-YMD[4,2,2] MTS.'),'D-MYD[4,2,2] MTHS')

the above derivation not returning any values to the Outlink.Field1

Any suggestions are most welcome

Thanks in advance
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You have to split the timestamp into date and time, convert them separately and then cat them back together. For you, all you need to handle is the time portion since the date isn't be reformatted.
-craig

"You can never have too many knives" -- Logan Nine Fingers
pxraja
Participant
Posts: 142
Joined: Fri Mar 14, 2008 10:22 am

Post by pxraja »

Hi chulett,

Thanks for your response,

but I noticed that while executing query from a oracle its displaying like
Inlink.Field1
2008-09-06-20.30.355465

what I had posted is not the one to be converted.

I could not able to make a query in oracle itself. But while running the datastage job and populating into oracle table having the datatype timestamp. Its output is like

Outlink.Field1
2008-09-06 08:30:35 PM

Its converting by itself but I need to define my conversion as

Outlink.Field1
2008-09-06 20:30:35

please any one can light me up

Thanks in advance
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Same advice applies: Separate, convert, combine. First off, what is your source for this field? If it is also Oracle, then you can save yourself all this work just by selecting it properly in the first place. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply