[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Axdeveloper

1/16/2006 9:19:00 AM

Hi,
I read some xml input data into a few tables. For example, i have a date
which i insert into a string field of a table. Later, i convert in code the
string to a date and put it into a new table like this: newField =
str2date(field,123).
What i would like to know is if the sequence "123" really is 123 and not
some other. If it is not 123, my date is not valid and i must throw an error.
Can i determine the date's format with an in-built axapta method or how can
i check it?
thanxs a lot
1 Answer

David Pokluda

1/26/2006 6:23:00 PM

0

I would use the following method to do that:

public date convert2date(str _dateValue)
{
date dateValue = str2date(_dateValue, 123);
;
if (str2date('', 123) == dateValue)
throw Exception::Error;

return dateValue;
}

Regards,
David.
"Axdeveloper" <Axdeveloper@discussions.microsoft.com> wrote in message
news:5BCF8D41-B145-4CEE-BF73-C5C2D1C5EF25@microsoft.com...
> Hi,
> I read some xml input data into a few tables. For example, i have a date
> which i insert into a string field of a table. Later, i convert in code
> the
> string to a date and put it into a new table like this: newField =
> str2date(field,123).
> What i would like to know is if the sequence "123" really is 123 and not
> some other. If it is not 123, my date is not valid and i must throw an
> error.
> Can i determine the date's format with an in-built axapta method or how
> can
> i check it?
> thanxs a lot