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
karry450
Participant
Posts: 201
Joined: Wed Nov 14, 2007 11:31 pm
Location: HYD

CONVERSION

Post by karry450 »

Hi friends


Can anyone tell me how to convert timestamp to date in transformer stage.

thanks
harish_s_ampeo
Participant
Posts: 26
Joined: Tue Dec 18, 2007 6:31 am

Post by harish_s_ampeo »

Just use to_date function as given below

to_date(column,'YYYY-MM-DD HH24:MI:SS')
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Wrong. That function belongs in an SQL query, not in a Transformer stage.

In a Transformer stage simply take the leftmost ten characters, or the first space-delimited field, from the timestamp. This works because there are no data types in server jobs.

Code: Select all

Left(InLink.TheTimestamp,10)
Field(InLink.TheTimestamp, " ", 1, 1)
If you need an internal format date, apply an Iconv() function to that result.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
karry450
Participant
Posts: 201
Joined: Wed Nov 14, 2007 11:31 pm
Location: HYD

conversion

Post by karry450 »

ray.wurlod wrote:Wrong. That function belongs in an SQL query, not in a Transformer stage.

In a Transformer stage simply take the leftmost ten characters, or the first space-delimited field, from the timestamp. T ...

thanks but how do you implement in transformer stage.
MOHAMMAD.ISSAQ
Participant
Posts: 78
Joined: Fri Mar 02, 2007 4:54 am
Location: CHENNAI

Post by MOHAMMAD.ISSAQ »

You can use "Left" function or "Substring".

If you're not sure of the length of the date format i,e. DD/MM/YYYY(10 Characters) or YYYYMMDD(8 Characters) then you can do like this:


Output:- Left(DSLink8.TIMESTAMP,Index(DSLink8.TIMESTAMP,' ',1))
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

A full and general solution was given in my earlier reply.

Premium membership is worth it. Less than 30c per day. 100% of this goes to the hosting and bandwidth costs incurred by DSXchange.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
jlock23
Participant
Posts: 18
Joined: Wed May 11, 2005 9:16 am

Post by jlock23 »

I always use OCONV and ICONV to do conversions in date formats.
Post Reply