I'm having a terrible time trying to format date/time from the installed software registry key (uninstall key) due to many formats being used.
Some example dates:
Does anyone have ideas on how I can best do this? I need to format to a mysql date time field and I can format the last 2 examples, its the first one that is throwing me off.
Here is what I have so far
Thanks
Some example dates:
Code:
Fri Nov 02 19:20:55 CST 2007
9/18/2006
4-26-2004
Does anyone have ideas on how I can best do this? I need to format to a mysql date time field and I can format the last 2 examples, its the first one that is throwing me off.
Here is what I have so far
Code:
Function mySqlDate(myDate)
If Len(myDate) > 0 Then
If Len(myDate) > 8 Then
YMD = ( Year(myDate)*100 + Month(myDate) )*100 + Day(myDate)
hms = Right((Hour(myDate)*100+Minute(myDate))*100+Second(myDate)+1e7, 6)
mySqlDate = Left(YMD,4) & "-" & Mid(YMD,5,2) & "-" & Mid(YMD,7,2) & " " & Left(hms,2) & ":" & Mid(hms,3,2) & ":" & Mid(hms,5,2)
Else
mySQLDate = Left(myDate,4) & "-" & Mid(myDate,5,2) & "-" & Mid(myDate,7,2)
End If
Else
mySqlDate = "0000-00-00"
End If
End Function
Thanks