Problem while converting into date to string format

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
hhh
Participant
Posts: 86
Joined: Tue Aug 02, 2005 7:39 am

Problem while converting into date to string format

Post by hhh »

Hello Friends,

i want to convert date into string with format of <month name><dd><yyyy' but there is no function for convert Full month name from date value field ex. 11-12-2004 Then Output like December 11 2004.
In Transformer stage i have used DateToString Function and used 'mmm' but it takes upto 3 characters of month name, however my requirement is for whole month name.
If any Function,routine in Px which can directly convert into necessary format so please let me know.

Thanks
Hiten
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Hiten,

PX has no built-in function to do this; you could either write your own in C++ or you would need to code it into the job. The following would work:

Code: Select all

Field('January,February,March,...",",",MonthNumber)
MonthNumber is the extracted month from the date.
hhh
Participant
Posts: 86
Joined: Tue Aug 02, 2005 7:39 am

Post by hhh »

Thanks Arndw,
your formula is good
ArndW wrote:Hiten,

PX has no built-in function to do this; you could either write your own in C++ or you would need to code it into the job. The following would work:

Code: Select all

Field('January,February,March,...",",",MonthNumber)
MonthNumber is the extracted month from the date.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Hi,
Another workaround is create a seperate table and to do a lookup for each month.

regards
kumar
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Kumar,

using a lookup file/table would work, but would be much slower. I think that an IF...THEN...ELSE construct would also work, and would be fast if you could order the statements by order of frequency.
Post Reply