Page 1 of 1

Error while checking date

Posted: Thu Aug 09, 2007 1:44 am
by rafidwh
Hi All,

I am validating a date using isValid function,I am getting an error when the date is invalid.

The input date format is dd/mm/yyyy
The function used is IsValid("DATE", StringToDate(DSLink3.Date,"%dd/%mm/%yyyy")

Now if the date is 32/32/2008 or 00/00/0000 then it gives a warning

:"Conversion error calling conversion routine date_from_string data may have been lost"

Please suggest me why this warning is getting and how to validate if it is invalid.

Thanks in advance

Regards,
Rafidwh

Posted: Thu Aug 09, 2007 2:29 am
by Maveric
Use an If Then Else statement. if valid Then () Else default value. Something like that.

Posted: Thu Aug 09, 2007 2:56 am
by rafidwh
I am using If then Else,but getting the same warning

Posted: Thu Aug 09, 2007 3:42 am
by G SHIVARANJANI
Try this:

If
StringToDate(DSLink3.Date,"%dd/%mm/%yyyy")[1,2] = '**' then 0 else 1

Maveric wrote:Use an If Then Else statement. if valid Then () Else default value. Something like that.

Posted: Thu Aug 09, 2007 5:31 am
by rafidwh
Getting the same warning

Conversion error calling conversion routine date_from_string data may have been lost

Posted: Thu Aug 09, 2007 6:27 am
by G SHIVARANJANI
Please Do NullHandling In stage variable and then go ahead with validation:

like:

If Trim(DSLink3.Date) = '' then 0
else If StringToDate(Trim(DSLink3.Date),"%dd/%mm/%yy")[1,2]= '**'
Then 0
else 1

rafidwh wrote:Getting the same warning

Conversion error calling conversion routine date_from_string data may have been lost

Posted: Thu Aug 09, 2007 6:36 am
by G SHIVARANJANI
If IsNull(DSLink3.Date) then 0
else If StringToDate(Trim(DSLink3.Date),"%dd/%mm/%yy")[1,2]= '**'
Then 0
else 1

G SHIVARANJANI wrote:Please Do NullHandling In stage variable and then go ahead with validation:

like:

If Trim(DSLink3.Date) = '' then 0
else If StringToDate(Trim(DSLink3.Date),"%dd/%mm/%yy")[1,2]= '**'
Then 0
else 1

rafidwh wrote:Getting the same warning

Conversion error calling conversion routine date_from_string data may have been lost