How to convert mm/dd/yyyy to dd-mmm-yy in classic asp

The following is the code for converting mm/dd/yyyy to dd-mmm-yy in classic asp


<%

'INPUT DATE EXAMPLE: 12/31/2009

'OUTPUT EXAMPLE: 31-DEC-09



function ddmmmyy(this_date)

dim dd_this_date,mm_this_date,yy_this_date

if this_date="" then

ddmmyy=""

elseif not isDate(this_date) then

ddmmyy=this_date

else

dd_this_date=day(this_date)

if dd_this_date <10 then

dd_this_date="0" & dd_this_date

end if

mm_this_date=mid(monthname(month(this_date)),1,3)

yy_this_date=right(year(this_date),2)

ddmmmyy=dd_this_date & "-" & mm_this_date & "-"
& yy_this_date

end if

end function

%>