date conversion plz advice

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
bobby
Participant
Posts: 86
Joined: Mon Jul 19, 2004 8:31 pm

date conversion plz advice

Post by bobby »

Hi,
please advice i have date in varchar want to change in Timestamp
12-oct-2004(varchar) to 2004-10-12 00:00:00 (Timestamp)
Thanks,
Bobby
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Hello Bobby,

you could use OCONV(ICONV(In.Date,"D4-DMY"),"D4-YMD[4,2,2]"):" 00:00:00". This will work for your sample but of course doesn't do any error checking in case the input date has an invalid format.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Spend some time learning about DataStage's date conversion functions. The paper Date Conversion Demystified is a good place to start.

Search the Forum; there are answers to your exact requirement to be found. Essentially you convert the incoming date into DataStage internal format, then convert that into exactly the output format you require. Add the time component using string concatenation.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Rahul Reddy
Participant
Posts: 7
Joined: Wed Nov 03, 2004 6:11 am

Re: date conversion plz advice

Post by Rahul Reddy »

You can also change this date field to timestamp using an user defined SQL (if your source is a database). Else better to use ICONV and OCONV.

bobby wrote:Hi,
please advice i have date in varchar want to change in Timestamp
12-oct-2004(varchar) to 2004-10-12 00:00:00 (Timestamp)
Thanks,
Bobby
Post Reply