By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,640 Members | 1,331 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,640 IT Pros & Developers. It's quick & easy.

IsDate problem

P: n/a
Why does

IsDate("01:01:0_")

return true??

Thanks

Jack Russell
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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

Nov 21 '05 #2

P: n/a
Fair enough but if vb.net supports it shouldn't it work?
Rykie wrote:
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

Nov 21 '05 #3

P: n/a
Jack Russell wrote:
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
Nov 21 '05 #4

P: n/a
"Rykie" <ry**********@gmail.com> schrieb:
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.

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

Nov 21 '05 #5

P: n/a
"Jack Russell" <ja***@norubbish.tpg.com.au> schrieb:
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...
///

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

Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.