Page 1 of 1

month from date

Posted: Tue Feb 26, 2008 3:11 am
by consulting
Hi
I have date column like 20070203
20070912
........the format is yyyymmdd in text file i want to split month only ie 02
09...

How to achive it in parallel? what function should be used?


thanks
Balaji G

Posted: Tue Feb 26, 2008 3:26 am
by Maveric
From your examples i would assume that the input is always 8 characters long. So a simple substring like In.Col[5,2] in a transformer stage would do.

Posted: Tue Feb 26, 2008 3:55 am
by ray.wurlod
If you have a Date column is does NOT have a format: your Sequential File stage specifies the date format in the file and the import operator looks after it. If it's a Char or VarChar data type then the format is important.

There are date conversion functions both for the Modify stage and for the Transformer stage for extracting components from dates.

Posted: Wed Feb 27, 2008 4:03 am
by consulting
Thanks
In server we can use substring. How about in Px?

Posted: Wed Feb 27, 2008 4:11 am
by priyadarshikunal
consulting wrote:Thanks
In server we can use substring. How about in Px?
you can use substring in PX too.

Code: Select all

datecolumn[5,6]
Regards,

Posted: Wed Feb 27, 2008 4:39 am
by ray.wurlod
ONLY if it is a string. If it is a date, you need to apply a date to string conversion function first.

There are other functions available that will extract date components directly from dates.