Public Function DateSQL(varDate As Variant) As String
DateSQL = "#" & Month(varDate) & "/" & Day(varDate) & "/" & Year(varDate) & "#"
End Function
Public Function funFormatDate(datDate As Date) As String
funFormatDate = Format(datDate, "\#mm\/dd\/yyyy\#")
End Function
Public Function Test()
Dim datTest As Date
Dim i As Long
Dim strResponse As String
datTest = Date
Debug.Print "Start DateSQL", Time()
For i = 1 To 5000000
strResponse = DateSQL(datTest)
Next i
Debug.Print "End DateSQL", Time()
Debug.Print
Debug.Print "Start funFormatDate", Time()
For i = 1 To 5000000
strResponse = funFormatDate(datTest)
Next i
Debug.Print "End funFormatDate", Time()
Debug.Print
End Function
|