Page 1 of 1

String to Date - Format issue

Posted: Fri Sep 23, 2016 8:47 am
by balu536
Hi,
I need to convert incoming String to Date. The format of the string is "Month dd, yyyy" Ex: (November 29, 2012).

I used below function and job got aborted with error " Invalid type: November 29, 2012."

StringToDate(Input Column,"%mmmm %dd, %yyyy").

Please help on this.

Posted: Fri Sep 23, 2016 9:57 am
by balu536
The issue was with IsValid function. Ran to success after making below change

Before:
IF
IsValid(Source, "%mmmm %dd, %yyyy")
THEN
StringToDate(Source,"%mmmm %dd, %yyyy") ELSE SetNull()

After:
IF
IsValid("date",Source, "%mmmm %dd, %yyyy")
THEN
StringToDate(Source,"%mmmm %dd, %yyyy") ELSE SetNull()

Posted: Fri Sep 23, 2016 10:10 am
by chulett
Right. You need to tell it what kind of validation it needs to do. And don't fall into the trap of thinking you can use IsValidDate instead. :wink: