Click to See Complete Forum and Search --> : Type mismatch 'clng'


magus
09-16-2003, 01:09 AM
I have a function for converting datetime into military format, like this:

<%
Function DoFormat2(theDate)
Dim strDate
strDate = ""
fd = FormatDateTime(theDate,2)
ft = FormatDateTime(theDate,3)
if right(ft,2)="PM" then
t = split(ft,":")
milhour = clng(t(0))
if clng(left(ft,2))<12 then milhour = milhour +12
mtime = cstr(milhour) & ":" & t(1)
mtime = mtime & ":" & left(t(2),2)
elseif clng(left(ft,2))=12 then ' this handles midnight only
mtime = "00:"
mins = datepart("n",ft)
secs = datepart("s",ft)
mtime = mtime & left("00",2-len(mins)) & mins
mtime = mtime & left("00",2-len(secs)) & ":" & secs
else
mtime = left(ft,len(ft)-3)
end if
strDate = fd & " " & mTime
DoFormat2 = strDate
end Function
%>

When I ran the function, always generate error: type mismatch: 'clng' on the red line. Can somebody help me...?

rdoekes
09-16-2003, 10:33 AM
should that not be: if Clng(t(0)) < 12 Then?