Page 1 of 1

CONVERSION

Posted: Mon Feb 04, 2008 3:51 am
by karry450
Hi friends


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

thanks

Posted: Mon Feb 04, 2008 3:59 am
by harish_s_ampeo
Just use to_date function as given below

to_date(column,'YYYY-MM-DD HH24:MI:SS')

Posted: Mon Feb 04, 2008 4:04 am
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.

conversion

Posted: Mon Feb 04, 2008 4:09 am
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.

Posted: Mon Feb 04, 2008 6:07 am
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))

Posted: Mon Feb 04, 2008 4:28 pm
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.

Posted: Tue Feb 05, 2008 1:34 pm
by jlock23
I always use OCONV and ICONV to do conversions in date formats.