Page 1 of 1

DateFromString Function

Posted: Tue Jun 29, 2010 8:06 pm
by Rajesekhar
Hi Iam trying to convert String to Date using Modify Stage.

And the function which iam using is

Date:Date=date_from_string[%mmm %dd, %yyyy](Date)

My input format is of string and is like June 14, 2010

when I run this it gives a warning saying

Data string 'June 14, 201' does not match format '%mmm %dd, %yyyy': an integer was expected to match tag %dd.

What is this warning, how to resolve this please help!!

-thanks, Raj.

Posted: Tue Jun 29, 2010 8:32 pm
by ray.wurlod
"%mmm" matches the three-character abbreviation of the month name.

You need to research the correct formulation in the date format picture. From memory - because I can't check at the moment, the full month name is pictured by "%mmmm".

date Function by Using Modify stage

Posted: Wed Jun 30, 2010 1:02 am
by rameshkm
Hi Rajeseaker,
You mention as Date:Date= What is the first Date mean is it the column name , if yes please change the Column name because The Date is datatype so it not accept as column name, the correct syntax is

Source _ColumnName:datatype =date_from_string(Destination column name["%mmm %dd, %yyyy"]
Let me know if it work

Posted: Wed Jun 30, 2010 1:43 am
by Sreenivasulu
I think you need training in 'datastage'. :)

Posted: Wed Jun 30, 2010 6:12 am
by antonyraj.deva
As pointed by Ray, for full month name %mmmm should be specified.

"%mmm" will give January as Jan, September as Sep etc,.

So the code for your requirement is

Code: Select all

Source _ColumnName:datatype =date_from_string(Destination column name["%mmmm%dd, %yyyy"]