FUNCTION check_2000(date_check)
' THIS WORKS FOR ME (CHRIS ANDERSON), BUT YOU SHOULD CHECK IT FOR YOUR
' OWN PURPOSES ! - I HAVE SET MY DATE RANGE AS 1980/2079 ' IF YOU WANT
' TO CHANGE THIS SEE BELOW
'example calls:
'check_2000("01.01.00")   returns   01.01.2000
'check(36612)             returns   28.03.2000   ' if sent as number
'check("36612")           returns   28.03.2000   ' if sent as text

' THIS WORKS WELL FOR ME, BUT I AM SURE IT CAN BE CLEANED UP A BIT - IF YOU
' DO, I WOULD WELCOME A COPY ON CJCS@COMPUSERVE.COM - thanks


local return_data day month year x this_char so_far no_dots dot1 dot2
local start_pos month_len its_a_date

if isnumber(date_check)  ' if number passed convert to date
date_check = date2(date_check)
end if

' if number passed as text ie "35789" ' convert
if isstring(date_check)
for x = 1 to len(date_check)

if mid(date_check,x,1) == "." or\
   mid(date_check,x,1) == "/" or\
   mid(date_check,x,1) == "\"
its_a_date = true
exit for
end if

end for
end if

if its_a_date = true
' leave alone
else
date_check = date2(value(date_check))
end if

'²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²
'² WORKS UP TO YEAR 2079 !!!  after that im not bothered !!!   ²²²²²²²²²²²²²²²²
'²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²
so_far = 0
'²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²
for x = 1 to len(date_check)
this_char = mid(date_check,x,1)
so_far = so_far + 1

if this_char = "." or this_char = "/" or this_char = "\"
exit for
end if

end for
dot1 = so_far
'²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²
so_far = 0
no_dots = 0

for x = 1 to len(date_check)
so_far = so_far + 1

this_char = mid(date_check,x,1)

if this_char = "." or this_char = "/" or this_char = "\"
no_dots = no_dots + 1
end if

if no_dots = 2
exit for
end if

end for
dot2 = so_far
'²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²
day = str(left(date_check,dot1-1))

start_pos = dot1+1
month_len = dot2-dot1-1   '  ie 2 for 01.01.97

month = str(mid (date_check,start_pos,month_len))

year = str(right(date_check,(len(date_check)-dot2)))

if value(year) <  80  ' CHANGE THIS IF YOU WANT DIFFERENT DATES SUPPORTED
year = str  (  2000   +   value(year)  )
end if

return_data = day|"."|month|"."|year
return return_data
END FUNCTION
