Re: Problem in Date format
You'll have to manually convert them. When you try to cast a string to a date, it will use your regional settings to determine the date and month. The reason your second example works is because VB is smart enough to figure out that there is no month "18", and assumes it's the day. This should do the trick:
VB Code:
Private Sub TryIt()
Dim sTest As String
sTest = DateConvert("02-05-2006 20:53:56")
Debug.Print sTest
Debug.Print Format$(sTest, "General Date")
Debug.Print Format$(sTest, "mm/dd/yyyy HH:mm")
End Sub
Private Function DateConvert(sInput As String) As Date
Dim sDateTime() As String, sDate() As String
sDateTime = Split(sInput, " ")
sDate = Split(sDateTime(0), "-")
DateConvert = DateValue(sDate(1) & "/" & sDate(0) & "/" & sDate(2))
DateConvert = DateConvert + CDate(sDateTime(1))
End Function