IsDate problem

  • Thread starter Thread starter Jack Russell
  • Start date Start date
Jack Russell,

IsDate is a visual basic function (6), try to use something like
Date.Parse(01:01:0_") or Date.ParseExact(01:01:0_") and see if you
still get the same error.

Rykie
 
Jack said:
Why does

IsDate("01:01:0_")

return true??

Because it can be parsed to #1:01:00 AM# (and it seems to think the date in
the sense you intend is 01/01/0001).

I suppose you could parse it with MyDate=CDate("01:01:0_") and if
MyDate.Year=1 then it was only a time without a date. Unless 1 is a valid
year in your application.

Andrew
 
Rykie said:
IsDate is a visual basic function (6), try to use something like
Date.Parse(01:01:0_") or Date.ParseExact(01:01:0_") and see if you
still get the same error.

'IsDate' doesn't have a bug. 'CDate' is able to interpret the string
"01:01:0_" as a valid time string.
 
Jack Russell said:
Fair enough but if vb.net supports it shouldn't it work?

It actually works. However, 'IsDate'/'CDate' of VB.NET are not compatible
to VB6's 'IsDate'/'CDate' functions/commands:

\\\
MsgBox(IsDate("11a")) ' 'True' in VB6, 'False' in VB.NET...
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top