Page 1 of 1

Check for StringtoDate

Posted: Mon Oct 15, 2007 11:07 am
by ds_is_fun
How to check if StringtoDate converts successfully? The format being "yyyy-dd-mm". Thanks

Posted: Mon Oct 15, 2007 12:16 pm
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.

Posted: Mon Oct 15, 2007 4:44 pm
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.

Re: Check for StringtoDate

Posted: Tue Oct 16, 2007 3:26 am
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

Posted: Tue Oct 16, 2007 3:54 am
by balajisr
Try this.

Code: Select all

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