-
I have a VB6 application that manages dates in many ways and one of my customers likes to use a period (".") as date separator in its regional settings. The glitch is that it does not seem to be supported by VB since when I use a period as date separator and I call...
IsDate(Format(Now))
- or -
IsDate("01.01.2000")
...it always return False. And when I call...
CDate(Format(Now))
- or -
CDate("01.01.2000")
...it gives me a run-time 13 (Type Mismatch).
Even if I use other separators for decimal and thousand, it keeps failing.
Anybody has ever heard of this? If so, does somebody have a solution?
My application is quite big and I am affraid workarounds would not solve my problem.
Thanks in advance,
Tipi
-
Change the date/time separator in Control Panel / Regional Settings - not only will this display all dates with . between the numbers but the IsDate function (which uses the control panel settings) will return True.
I think.. !! :)
------------------
Mark "Buzby" Beeton
VB Developer
[email protected]
-
One thing you can do is use the VB6 Replace function to replace the . with - ....
eg.
Dim sTemp As String
sTemp = Replace(txtDate.Text, ".", "-")
And then use sTemp to check if entered date is valid.
-
I guess I was not clear enough. I already use a period in my regional settings. The problem is that:
IsDate("01.JAN.2000")
- and -
IsDate(Format(Now))
return False. The second example will work if you use a MM month format. It will fail with a MMM month format. I have made a mistake in my first message when I mentionned that "01.01.2000" would return False.
Thanks,
Tipi
[This message has been edited by Tipi (edited 02-15-2000).]