Date 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
nshashi.85
Participant
Posts: 7
Joined: Mon Apr 21, 2008 3:12 am

Date Conversion

Post by nshashi.85 »

I am having a flat file with date format yyyymmdd. In my target table i want to change this date format into 'yyyy-mm-dd' using transformer. Please tell me , what function should i use???


Any Help?
SHASHI
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In server jobs there are no data types, so you can treat both as strings and simply use substrings and concatenation.

Code: Select all

InLink.TheString[1,4] : "-" : InLink.TheString[5,2] : "-" : InLink.TheString[7,2]
Or you could use Fmt() function, or a combination of Oconv() and Iconv().

Code: Select all

Fmt(InLink.TheString,"L####-##-##")

Code: Select all

Oconv(Iconv(InLink.TheString,"DYMD"),"D-YMD[4,2,2]")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
devidotcom
Participant
Posts: 247
Joined: Thu Apr 27, 2006 6:38 am
Location: Hyderabad

Post by devidotcom »

use the following and try

StringtoDate(Input.column,'"%yyyy-%mm-%dd')
devidotcom
Participant
Posts: 247
Joined: Thu Apr 27, 2006 6:38 am
Location: Hyderabad

Post by devidotcom »

Oops I thought it was parallel job...
PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

Post by PhilHibbs »

I'd do the []: style, but I'd wrap it in a Transform. I don't trust the efficiency of a generic function like Fmt or Oconv.
Phil Hibbs | Capgemini
Technical Consultant
Post Reply