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
deva
Participant
Posts: 104
Joined: Fri Dec 29, 2006 1:54 pm

date conversion

Post by deva »

Hi
I have one date field which is timestamp. its formate is mm/dd/yyyy hh:mm:ss.
I want to convert that time stamp to date as yyyymmdd or yyyy-mm-dd

Can any one suggest me on this.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

If you always get two digit months and day, then you can substring it apart and put it back together however you please. Otherwise, standard IConv/OConv pairs will do the trick.
-craig

"You can never have too many knives" -- Logan Nine Fingers
dsean
Participant
Posts: 22
Joined: Thu Feb 09, 2006 12:52 pm

Post by dsean »

As Chulett said, you can use substr to get the date only from the input format that you have mentioned.

Else you can use built in transform TIMESTAMP.TO.DATE along with either OCONV function or DATE.TAG to get the date only from the timestamp.

Note : The input date format must be 'YYYY-MM-DD HH:MM:SS' to use TIMESTAMP.TO.DATE transform.
Post Reply