Page 1 of 1

Sort Order

Posted: Thu Nov 11, 2010 2:53 pm
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

Posted: Thu Nov 11, 2010 3:00 pm
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'))

Posted: Thu Nov 11, 2010 3:19 pm
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

Posted: Thu Nov 11, 2010 3:21 pm
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

Posted: Thu Nov 11, 2010 3:22 pm
by anbu
Can you post your input and output?

Posted: Thu Nov 11, 2010 3:26 pm
by naveen.p
Hi,

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

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

Thanks,
Naveen

Posted: Thu Nov 11, 2010 3:31 pm
by anbu
Are you not getting your desired output?

Posted: Thu Nov 11, 2010 3:34 pm
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

Posted: Thu Nov 11, 2010 4:09 pm
by suryadev
try using the two functions seperately in two transformers....

one for date to string and other for string to date