string to date

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
vishal_rastogi
Participant
Posts: 47
Joined: Thu Dec 09, 2010 4:37 am

string to date

Post by vishal_rastogi »

Hi

i have input field as 09062007 and the output is the date format
i am using the string to date function

StringToDate(DSLink3.col1,"%dd-%mm-%yyyy")

but in the output i am getting "**********"

and similarily for one field i need to convert the same input to timestamp but it is also giving the * values

please suggest..
Vish
kamtammystuff
Participant
Posts: 26
Joined: Fri Feb 19, 2010 2:08 am

Re: string to date

Post by kamtammystuff »

Hi

Here the second parameter should always represent your input string format.
vishal_rastogi
Participant
Posts: 47
Joined: Thu Dec 09, 2010 4:37 am

Post by vishal_rastogi »

yes i agree it is in the same format please take a look one more time
Vish
kiran0435
Participant
Posts: 39
Joined: Sun Sep 26, 2010 10:28 pm

Post by kiran0435 »

use the function as

StringToDate(DSLink3.col1,"%dd%mm%yyyy") .
This will work.
vishal_rastogi
Participant
Posts: 47
Joined: Thu Dec 09, 2010 4:37 am

Post by vishal_rastogi »

what if i want the output in the format mm/dd/yyyy
Vish
kamtammystuff
Participant
Posts: 26
Joined: Fri Feb 19, 2010 2:08 am

Post by kamtammystuff »

It depends on the default format defined at you project level.
Last edited by kamtammystuff on Mon Aug 01, 2011 4:40 am, edited 2 times in total.
kiran0435
Participant
Posts: 39
Joined: Sun Sep 26, 2010 10:28 pm

Post by kiran0435 »

StringToDate(inputcolumn,[input date format](in your case it is "%dd%mm%yyyy")).

The output for this function will be based on project level parameter which is set in Administrator client for this project.

But you can override with necessary format based on your requirement in job parameters.

go to job parameters--- default tab--- then change format defaults according to your requirement.
vishal_rastogi
Participant
Posts: 47
Joined: Thu Dec 09, 2010 4:37 am

Post by vishal_rastogi »

thanks kiran its working fine for me now
Vish
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Hmmm... DATE datatypes don't have formats, people. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply