Converting from 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
skyboyfli
Participant
Posts: 32
Joined: Fri Jun 04, 2010 8:21 am
Location: hyd
Contact:

Converting from string to date

Post by skyboyfli »

I have a field like in this format 23-jul-09

I tried convert it into date as
StringToDate(Ln_Sq.Field05,"%dd-%mmm-%yy")

StringToDate(Ln_Sq.Field05,"%dd-%mon-%yy")


But both there are not working, i am getting warning like this:
'Data string ' 26-JUN-1' does not match format '%dd-%mmm-%yy': an integer was expected to match tag %dd.'

Can anybody tell em the structure of the function to get the format 'YYYY-MM-DD'
this is nice
ajith_infy
Participant
Posts: 4
Joined: Wed Oct 27, 2010 2:22 am

Post by ajith_infy »

Apply Trim function on string before converting to date
skyboyfli
Participant
Posts: 32
Joined: Fri Jun 04, 2010 8:21 am
Location: hyd
Contact:

Post by skyboyfli »

ajith_infy wrote:Apply Trim function on string before converting to date
I did not get you...

which one to be trimmed in the string...
it is not having any unnecessary chars to trim
this is nice
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Your data string error message shows a leading space, which, as ajith_infy has already seen, needs to be removed in order for the format to match.
skyboyfli
Participant
Posts: 32
Joined: Fri Jun 04, 2010 8:21 am
Location: hyd
Contact:

Post by skyboyfli »

ajith_infy wrote:Apply Trim function on string before converting to date
Thanks ajith....
i got it.
this is nice
Post Reply