Decimal to Date Conversion

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
kumar3846
Participant
Posts: 36
Joined: Mon Jan 09, 2006 2:58 pm

Decimal to Date Conversion

Post by kumar3846 »

Hi All,

I have a date filed coming from Input as Decimal (13,5) Value : 09092008.39699 , i want this value as date in to the target and i tried as shown below but when i am trying to convert it to date i am getting the followin error

" APT_CombinedOperatorController,3: Data string '20090304' does not match format '%yyyy-%mm-%dd': an integer was expected to match tag %dd. "

My Code Is :
Date = Left(DecimalToString(DATE_OPENED),9)

StringToDate(Trim(date)[5,4] :Trim(date)[1,2]:Trim(date)[3,2],'%yyyy-%mm-%dd')


Please suggest me if i am doing any thing wrong above or any new logic if you guys have , Thanks in advance for your valuble Suggestions.

Thanks,
Kumar
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Post by nagarjuna »

Try

StringToDate(Trim(date)[5,4] :'-':Trim(date)[1,2]:'-':Trim(date)[3,2],'%yyyy-%mm-%dd')
Nag
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

or use %dd%mm%yyyy or %mm%dd%yyyy format (US or UK) to your source date rather than splitting.
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

Sainath.Srinivasan wrote:or use %dd%mm%yyyy or %mm%dd%yyyy format (US or UK) to your source date rather than splitting. ...
Just to be picky... that is "UK or US" format... :D

But would agree just to use this format rather than trying to remodel, (OP) just make sure you substring for the first 8 characters, not 9 as you have done
Post Reply