I am using this code to convert a string date to real date.
Dim newDate As String
newDate = Left(strDate, 2) & "/" & Mid(strDate, 4, 2) & "/" & Right(strDate, 4)
ConvertDate = newDate
The problem is that if the format of the date is not like dd/mm/yyyy (10/10/2005) the code errors. Can anyone advise how to overcome this, the date can be in other formats ie d/mm/yyyy (5/10/2005. I was considering a select code but unsure how to identify the different formats.
Dim newDate As String
newDate = Left(strDate, 2) & "/" & Mid(strDate, 4, 2) & "/" & Right(strDate, 4)
ConvertDate = newDate
The problem is that if the format of the date is not like dd/mm/yyyy (10/10/2005) the code errors. Can anyone advise how to overcome this, the date can be in other formats ie d/mm/yyyy (5/10/2005. I was considering a select code but unsure how to identify the different formats.