G
Greg Maxey
Is there any way to preserve formatting with date conversion.
Sub Test()
Dim myString As String
Dim myDate As Date
myString = "February 12, 1969"
myDate = CDate(myString)
End Sub
myDate in the above is returned as 2/12/69. I am trying to figure out how
to preserve the date format during conversion. If myString is 2/12/69 then
myDate should be 2/12/69. If myString is 12 February 1969 then myDate
should be 12 February 1969.
Can this be done without some elaborate analysis of mySting and setting up a
Format(myDate, ......) statement?
Thanks.
Sub Test()
Dim myString As String
Dim myDate As Date
myString = "February 12, 1969"
myDate = CDate(myString)
End Sub
myDate in the above is returned as 2/12/69. I am trying to figure out how
to preserve the date format during conversion. If myString is 2/12/69 then
myDate should be 2/12/69. If myString is 12 February 1969 then myDate
should be 12 February 1969.
Can this be done without some elaborate analysis of mySting and setting up a
Format(myDate, ......) statement?
Thanks.