Function VBFormatDate(byval strDate,byval strFormat)
	dim sMonth,sMonthFull,TestDate
		
	on error resume next
	
	if isnull(strDate) or len(strDate) = 0 then
		VBFormatDate = ""
		exit function
	end if
	
	TestDate = cdate(strDate)
	if err.number <> 0 then
		msgbox "This date is not valid",48,"Error..."
		VBFormatDate = ""
		err.Clear
		exit function
	end if
	
	if len(strDate) = 1 or len(strDate) = 2 then
		strDate = strDate + "/" + cstr(datepart("m",Now)) + "/" + cstr(datepart("yyyy",Now))
	end if
		
	if datepart("m",strDate)=1 then sMonth="Jan" : sMonthFull = "January" : End If
	if datepart("m",strDate)=2 then sMonth="Feb" : sMonthFull = "February" : End If
	if datepart("m",strDate)=3 then sMonth="Mar" : sMonthFull = "March" : End If
	if datepart("m",strDate)=4 then sMonth="Apr" : sMonthFull = "April" : End If
	if datepart("m",strDate)=5 then sMonth="May" : sMonthFull = "May" : End If
	if datepart("m",strDate)=6 then sMonth="Jun" : sMonthFull = "June" : End If
	if datepart("m",strDate)=7 then sMonth="Jul" : sMonthFull = "July" : End If
	if datepart("m",strDate)=8 then sMonth="Aug" : sMonthFull = "August" : End If
	if datepart("m",strDate)=9 then sMonth="Sep" : sMonthFull = "September" : End If
	if datepart("m",strDate)=10 then sMonth="Oct" : sMonthFull = "October" : End If
	if datepart("m",strDate)=11 then sMonth="Nov" : sMonthFull = "November" : End If
	if datepart("m",strDate)=12 then sMonth="Dec" : sMonthFull = "December" : End If

	VBFormatDate = cstr(datepart("d",strDate)) + "-" + sMonth + "-" + cstr(datepart("yyyy",strDate))
	
	if ucase(strFormat) = "DATETIME" then
		VBFormatDate = WebDate + " " + FormatDateTime(strDate,4)
	end if
	
	if ucase(strFormat) = "HH:MM" then
		VBFormatDate = FormatDateTime(strDate,4)
	end if
	
	if ucase(strFormat) = "MONTHSTART" then
		VBFormatDate = "01" + "-" + sMonth + "-" + cstr(datepart("yyyy",strDate))
	end if
	
	if ucase(strFormat) = "MMM YYYY" then
		VBFormatDate = sMonthFull + " " + cstr(datepart("yyyy",strDate))
	end if
	
	if ucase(strFormat) = "MMM" then
		VBFormatDate = sMonth
	end if
	
end function