Check for StringtoDate

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
ds_is_fun
Premium Member
Premium Member
Posts: 194
Joined: Fri Jan 07, 2005 12:00 pm

Check for StringtoDate

Post by ds_is_fun »

How to check if StringtoDate converts successfully? The format being "yyyy-dd-mm". Thanks
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Well, apply StringToDate() function in a stage variable. If its unsuccessful, the stage variable will have all stars or astrixs. You can test for that. Thats one of the ways. I am sure there are other ways, just wait for our experts to drop by.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Try to insert the date into a column whose data type is Date - it should fail if your data value is not a valid date. For most database types, anyway.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ravi_tubati
Participant
Posts: 5
Joined: Wed Feb 08, 2006 12:54 am

Re: Check for StringtoDate

Post by ravi_tubati »

ds_is_fun wrote:How to check if StringtoDate converts successfully? The format being "yyyy-dd-mm". Thanks
you can use datefromdayssince to add the days which u given date
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

Try this.

Code: Select all

IsValid('date',StringToDate(date,'%yyyy-%dd-%mm'))
Post Reply