[thelist] Friday Freebie (early)

Scott Dexter sgd at ti3.com
Thu May 11 18:48:48 2000


because I actually have a day off tomorrow:

<tip type="ASP/LDAP">
Wanna pass a date to an LDAP property (like lastVisit)? --You gotta format
it right:

<%
function MakeDate(byval dval)
' converts a VBScript looking date to an LDAP formatted date
' piece dval into yyyymmddhhmmss
if not isDate(dval) then dval = Now
MakeDate =
year(dval)&zeropad(month(dval),2)&zeropad(day(dval),2)&zeropad(hour(dval),2)
&zeropad(minute(dval),2)&zeropad(second(dval),2)
end function

Function zeropad(byval val, byval ceiling)
if len(val)<ceiling then ' pad with zeros to make ceiling chars long
	for i=1 to ceiling-Len(val)
		val = "0"&val
	Next
end if
zeropad = val
End Function
%>

Fortunately for you, LDAP returns the date in the right format (you don't
have to convert it)
</tip>

sgd
--
think safely