Timestamp conversion

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
arnie_nits
Participant
Posts: 101
Joined: Mon Aug 13, 2007 2:32 am

Timestamp conversion

Post by arnie_nits »

Hi,

I am unable to convert 28-09-2008 01:01:00 to 2008-09-28 01:01:00. How to do this with Iconv and Oconv.

Regards,
Arnie
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

DataStage server has no timestamp, just Date and Time, so both parts need to be done separately. Assuming you have a string input value you need to:
Step 1, convert date to internal : ICONV(In.Date[1,10],'D4-DMY')
Step 2 convert internal to date : OCONV(Step1Result,'D4-YMD')

Everything in one line:

Code: Select all

OCONV(ICONV(In.Date[1,10],'D4-DMY'),'D4-YMD'):In.Date[11,9]
laknar
Participant
Posts: 162
Joined: Thu Apr 26, 2007 5:59 am
Location: Chennai

Post by laknar »

Try this

Code: Select all

Oconv(ICONV(In.Date[1,10],"D-MY(2,2,4)"),"Y-MD(4,2,2)"):Right(In.Date,9)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

laknar wrote:Try this

Code: Select all

Oconv(ICONV(In.Date[1,10],"D-MY(2,2,4)"),"Y-MD(4,2,2)"):Right(In.Date,9)
Almost, but not quite (and therefore wrong). You left the day specifications out of Iconv and Oconv arguments.

Code: Select all

Oconv(Iconv(Left(In.Date,10), "DDMY"), "D-YMD[4,2,2]") : Right(In.Date, 9)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply