am having one Excel file it contains the data with multiple sheets. In that One column having time stamp like 21/6/12 10:33:07:AM. My system date format is "m/d/yyyy"
while converting this to Date 21/06/2012. am able to get the date but it is showing in wrong. 06-12-2021 this should be 21-06-2012. am using the below code.
Ex : 26/6/12 11:15:07:AM should be 26/06/2012
21/6/12 10:33:07:AM should be 21/06/2012
Public Sub ConvtDate()
Dim ParseDateTime As Date
Application.ScreenUpdating = False
For Each datcol In ws_Raw2.Range("I2:I65536")
x = InStr(1, datcol, " ", vbTextCompare) - 1
If x > 0 Then
ParseDateTime = DateValue(Left(datcol, x))
datcol.Value = ParseDateTime
End If
Next
Application.ScreenUpdating = True
End Sub
Please help how to get the date.
Thanks in advance.