Barry said:
or you could learn regular expressions.
Alternatively, add the function below to a module, then you can get
the date by passing the format as well as the value you want to
convert to a date:
StringToDate([ServiceDateTime], 'mm/dd/yy-hhnn')
Public Function StringToDate(ByVal sInput As String, sFormat As
String) As Date
Dim sYear As String
Dim sMonth As String
Dim sDay As String
Dim sHour As String
Dim sMinute As String
Dim sSecond As String
Dim sDate As String
Dim sTime As String
Dim iPos As Integer
For iPos = 1 To Len(sInput)
Select Case UCase(Mid(sFormat, iPos, 1))
Case "Y"
sYear = sYear & Mid(sInput, iPos, 1)
Case "M"
sMonth = sMonth & Mid(sInput, iPos, 1)
Case "D"
sDay = sDay & Mid(sInput, iPos, 1)
Case "H"
sHour = sHour & Mid(sInput, iPos, 1)
Case "N"
sMinute = sMinute & Mid(sInput, iPos, 1)
Case "S"
sSecond = sSecond & Mid(sInput, iPos, 1)
Case Else
End Select
Next
sDate = sYear & "/" & sMonth & "/" & sDay
sTime = sHour & ":" & sMinute & IIf(sSecond <> "", ":", "") &
sSecond
StringToDate = 0
If IsDate(sDate) Then
StringToDate = CDate(sDate)
End If
If IsDate(sTime) Then
StringToDate = StringToDate + CDate(sTime)
End If
End Function