' Return a date from a string value based on a date format ' expC1 Date ' expN1 Format ' expC2 Time Public Function GetDateFromString(ByVal tcDate As String, ByVal tnFormat As Integer, _ ByVal tcTime As String) As Date Dim ldDate As Date Dim lnDay As Integer Dim lnMonth As Integer Dim lnYear As Integer Select Case tnFormat Case 1 lnDay = Val(Mid(tcDate, 1, 2)) lnMonth = Val(Mid(tcDate, 4, 2)) lnYear = Val(Mid(tcDate, 7, 4)) Case 2 lnDay = Val(Mid(tcDate, 4, 2)) lnMonth = Val(Mid(tcDate, 1, 2)) lnYear = Val(Mid(tcDate, 7, 4)) Case 3 lnDay = Val(Mid(tcDate, 9, 2)) lnMonth = Val(Mid(tcDate, 6, 2)) lnYear = Val(Mid(tcDate, 1, 4)) End Select If tcTime.Length = 0 Then ldDate = New Date(lnYear, lnMonth, lnDay) Else ldDate = New Date(lnYear, lnMonth, lnDay, Val(Mid(tcTime, 1, 2)), Val(Mid(tcTime, 4, 2)), _ Val(Mid(tcTime, 7, 2))) End If Return ldDate End Function