|
-
May 15th, 2001, 01:52 AM
#1
isDate problem
When I use isdate("31/04/01") it is interpreting
as '01/04/1931" and returned true.
Is there any way to interpret it '31/04/2001' when
we give 2 digit year and return false.
In SQL Server this is interpreted correctely.
tHANKS FOR ANY SUGGESTIONS
-
May 15th, 2001, 07:16 AM
#2
Re: isDate problem
Check the date format in control panel - Regional settings
Iouri Boutchkine
[email protected]
-
May 15th, 2001, 05:31 PM
#3
Re: isDate problem
Regional Settings have Short Date Format as
m/d/yy which is correct
Any more suggestions please
-
May 15th, 2001, 07:26 PM
#4
Re: isDate problem
I think you can just write a function to check it yourself.
first step : break the string into 3 token, where the "/" is the delimiter.
second step : convert tokens into integer value
third step : verify date, using day, month & year.
all of the required function can be found in http://vblib.virtulave.net
I enclose an example here, but u need to download the function.
Dim s as string
Dim sday as string
Dim smonth as string
Dim syear as string
Dim day as Integer
Dim month as Integer
Dim year as Integer
s = "31/04/01"
vbstrings.Tokenize s, Asc("/")
sday = vbstrings.GetToken
smonth = vbstrings.GetToken
syear = vbstrings.GetToken
day = Val(sday)
month = Val(smonth)
year = Val(syear)
If year < 100 then
year = year + 2000
End If
Debug.print vbdatetime.IsDateValid(day, month, year)
HTH
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|