We had a customer that had time saved as a string and needed it converted to a date time field. They wanted to combine it with another date field. Here is a simple script to convert in situaions like this in an SSIS transformaion script. By the way some of the time strings were null and some had bogus times in them. After writing it I should have added a check to make sure the time is between 0000 and 2400.
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Dim NewDateTime As Date
Dim HourStr As String
Dim MinuteStr As String
'validate time is not null
If Not (Row.NATIME_IsNull) Then
'Validate time is a 4 digit number
If IsNumeric(Row.NATIME) And Row.NATIME.ToString.Length = 4 Then
' break time into hours and minutes
HourStr = Row.NATIME.Substring(0, 2)
MinuteStr = Row.NATIME.Substring(2, 2)
Else ' iff time is not a 4 digit number
HourStr = "00"
MinuteStr = "00"
End If
Else ' if time is null
HourStr = "00"
MinuteStr = "00"
End If
'combine date and time
NewDateTime = CDate(CStr(DateSerial(Year(Row.Date), Month(Row.Date), DatePart("d", Row.Date))) + " " + _
CStr(TimeSerial(CInt(HourStr), CInt(MinuteStr), 0)))
'output row
Row.NewDateTime = NewDateTime
End Sub