Here is my code:
Dim DateD
DateStr = "July 17, 2001"
DateD = CDate(DateStr)
...
Running it VB reports a run time error Type Mismatch. What is wrong?
Printable View
Here is my code:
Dim DateD
DateStr = "July 17, 2001"
DateD = CDate(DateStr)
...
Running it VB reports a run time error Type Mismatch. What is wrong?
When I use that code it works fine, is there some more, code, try hitting debug and it will find the faulty line
I use bebug and the faulty line is
DateD = CDate(DateStr)
So, I cannot figure out what is wrong in code ...
Quote:
Originally posted by write2slappy
When I use that code it works fine, is there some more, code, try hitting debug and it will find the faulty line
Well, either send you program to [email protected] or post all your code , and i will exmaine it further
I bet vb doesn't consider this a date,
try MsgBox IsDate("July 17, 2001")
it will return false ... :(
MSDN Say the following:
hope this can help you solve your problem :)Quote:
CDate recognizes date formats according to the locale setting of your system. The correct order of day, month, and year may not be determined if it is provided in a format other than one of the recognized date settings. In addition, a long date format is not recognized if it also contains the day-of-the-week string.
Thank you all for helping me.
VB really doesnot recognise "July 17, 2001" as a date, the following code returns false:
DateStr="July 17, 2001"
Msgbox IsDate(DateStr)
My computer system is set to Russian version of date presentation. In my code I try to convert a date string with Ukrainian date "name-of-month-in-ukrainian dd, yyyy" to american date type "mmm dd, yyyyy", in result of all convertions I'd like to have a date value like that "17/07/01".