Date conversions

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
iamnagus
Participant
Posts: 48
Joined: Wed Sep 29, 2004 1:16 am

Date conversions

Post by iamnagus »

I want to convert the date format mmddyyyy to ddmmyyyy in MODIFY stage.

can any one explain the syntax for this.
karunakar.ds
Participant
Posts: 9
Joined: Fri Jun 01, 2007 12:14 am

Re: Date conversions

Post by karunakar.ds »

Why did you require the modify stage, you can directly do that using transformer.
Otherwise please let us know the exact recquirement

Thanks,
Karunakar
karun
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

In a transformer use substring to format the output. The code would be as :

Code: Select all

DateCol[4,2] : DateCol[1,2] : DateCol[5,4] 
But, the output should be of Char/Varchar datatype.
Thanks and Regards!!
dspxlearn
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Date data types, as I explained elsewhere, do not have formats. It is only when they are represented as string data type that the format becomes relevant. If you have dates, as you state, then your question is moot.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rsomiset
Premium Member
Premium Member
Posts: 46
Joined: Fri Sep 21, 2007 7:16 pm

Post by rsomiset »

Hi dspxlearn,
i think that the in the code that you have posted it is supposed to be
DateCol[3,2] since the date part starts at the 3rd position.
Correct me if i'm wrong, since i'm new to datastage.
--
Raj
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The third position in a Modify stage is actually 2 because, in Modify stage, everything uses C language conventions, including zero-based counting. However, in a Transformer stage, one-based counting is used.

Further, the square-bracket notation for substring is not supported in the Modify stage; instead you would need the

Code: Select all

substring[start,length](string)
formulation.

But it won't do you any good because concatenation is not supported at all in the Modify stage, in which only single-input-field functions are possible.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Eujishs
Participant
Posts: 1
Joined: Fri Jan 04, 2008 3:34 am
Location: Chennai

Post by Eujishs »

You can use IConv & OConv functions to change
Eujish
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Hello and welcome to DSXchange, Eujish!

You are right that the date conversions in ICONV/OCONV can be used, but only in Server jobs (or server stages in PX/EE jobs), and this is a PX/EE thread so those two functions aren't an option.
Post Reply