Sort Order

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
naveen.p
Participant
Posts: 55
Joined: Sat Nov 21, 2009 5:19 am
Location: Chennai

Sort Order

Post by naveen.p »

Hi,

I would like to sort the data on a Date column where the date format is 'YYYY-MM-DD'. I would like to convert the date format to MM-DD-YYYY.

Could any one help in this regard.

Thanks
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

First sort your input date and then use DateToString() followed by StringToDate()

Code: Select all

StringToDate(DateToString(date,'%yyyy-%mm-%dd'),'%mm-%dd-%yyyy'))
You are the creator of your destiny - Swami Vivekananda
naveen.p
Participant
Posts: 55
Joined: Sat Nov 21, 2009 5:19 am
Location: Chennai

Post by naveen.p »

Hi Anbu,

I converted the input date using string to date and date to string but i didnt get the desired output.

Thanks,
Naveen
naveen.p
Participant
Posts: 55
Joined: Sat Nov 21, 2009 5:19 am
Location: Chennai

Post by naveen.p »

Hi,

I tired using the conversion of date field to month from date concatenated with the year from date and 01 for the day.

Then use string to date but didnt get the desired output.

Thanks,
Naveen
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Can you post your input and output?
You are the creator of your destiny - Swami Vivekananda
naveen.p
Participant
Posts: 55
Joined: Sat Nov 21, 2009 5:19 am
Location: Chennai

Post by naveen.p »

Hi,

Input---------------Output

2010/02/01--------02/01/2010
2010/03/01--------03/01/2010

Thanks,
Naveen
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Are you not getting your desired output?
You are the creator of your destiny - Swami Vivekananda
naveen.p
Participant
Posts: 55
Joined: Sat Nov 21, 2009 5:19 am
Location: Chennai

Post by naveen.p »

Hi Anbu,

When i use String to Date and Date to string its giving the same output as the previous format.

Thanks,

Naveen
suryadev
Premium Member
Premium Member
Posts: 211
Joined: Sun Jul 11, 2010 7:39 pm

Post by suryadev »

try using the two functions seperately in two transformers....

one for date to string and other for string to date
Thanks,
Surya
Post Reply