Click to See Complete Forum and Search --> : isDate problem
Girija
May 15th, 2001, 01:52 AM
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
Iouri
May 15th, 2001, 07:16 AM
Check the date format in control panel - Regional settings
Iouri Boutchkine
iouri@hotsheet.com
Girija
May 15th, 2001, 05:31 PM
Regional Settings have Short Date Format as
m/d/yy which is correct
Any more suggestions please
cksiow
May 15th, 2001, 07:26 PM
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
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.