Home All Groups Group Topic Archive Search About

Invalid Date does not throw an exception

Author
23 Mar 2006 1:10 AM
gavin
Have a Windows for with a textbox.
Enter a date 2006/1/1/ -Note an additinal / on th end

This is clearly an error but when text is cast to a date the extra / is
automatically removed. The cast date displays as #1/1/2006#.

Is this correct?

Much appreciated.

Author
23 Mar 2006 8:07 AM
Cor Ligthert [MVP]
Gavin,

The behaviour of the datetime in strings is completely dependend from the
standards in your culture or the setting of that in the station. Therefore
an almost impossible to answer question for somebody outside your culture.
Be aware that Canada has by instance 2 cultures.

It does not help, however gives maybe an idea.

Cor

Show quoteHide quote
"gavin" <ga***@discussions.microsoft.com> schreef in bericht
news:5DCFF199-3698-4912-8F0D-6202907D7C3B@microsoft.com...
> Have a Windows for with a textbox.
> Enter a date 2006/1/1/ -Note an additinal / on th end
>
> This is clearly an error but when text is cast to a date the extra / is
> automatically removed. The cast date displays as #1/1/2006#.
>
> Is this correct?
>
> Much appreciated.
Author
23 Mar 2006 2:44 PM
Herfried K. Wagner [MVP]
"gavin" <ga***@discussions.microsoft.com> schrieb:
> Have a Windows for with a textbox.
> Enter a date 2006/1/1/ -Note an additinal / on th end
>
> This is clearly an error but when text is cast to a date the extra / is
> automatically removed. The cast date displays as #1/1/2006#.

Which method are you using to convert the string to a date?  'CDate'?

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>