' VBScript File

    Function FormatDate(ByVal theDate)

        Dim d1 As DateTime = theDate
        Dim dd As String = d1.Day.ToString()
        Dim mm As String = d1.Month.ToString()
        Dim yyyy As String = d1.Year.ToString()

        Dim aDayCount As Integer    ' This is for the days
        Dim aMonthCount As Integer  ' This is for the months

        aDayCount = Len(dd)
        aMonthCount = Len(mm)

        If (aDayCount = 1) Then
            dd = "0" & dd
        End If
        If (aMonthCount = 1) Then
            mm = "0" & mm
        End If

        Dim d2 As String = yyyy + mm + dd

        Return d2

    End Function

