Date conversion

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
rajkraj
Premium Member
Premium Member
Posts: 98
Joined: Wed Jun 15, 2005 1:41 pm

Date conversion

Post by rajkraj »

Hi ,

I have a String coming in as mm/dd/yy i.e 04/15/06 now i want to convert this string into another string of fotmat YYYYMMDD i.e 20060415.
I am using a transformer stage to do the conversion.

i tried doing StringToDate, it is giving the output as 1906-04-15.
How do i get output as 20060415.

Thanks
tomk
Premium Member
Premium Member
Posts: 5
Joined: Mon Sep 04, 2006 10:46 am
Location: Dallas, TX

Post by tomk »

Try using the following format when converting from a string to a date:
%mm/%dd/%2000yy

This will translate any yy on the input to 20yy.

When translating back to a string (for output), use the following format:
%yyyy%mm%dd
rajkraj
Premium Member
Premium Member
Posts: 98
Joined: Wed Jun 15, 2005 1:41 pm

Post by rajkraj »

Thanks Tom,that gave the desired result.Thank you.
Post Reply