I wrote a "comment" reader which interrogates every file in a .NET project folder and retrieves anything that starts with a single quote.
Often times there is a date like the following below. But the date is not always in a complete date format. Some have the time added, some don’t. They will always usually have month, day, year like so:
I need to be able to parse the date out if id exists but also eliminate the initials
The time would be nice to have but not necessary.
this code only gets a date if it matches this: 1-9-13 2:30pm DBP
Is there a way to get the date out of this consistently?
a few samples:
‘ 1-4-13 DBP
' 12-13-12 8:27am DBP
' 12-12-12 2:04pm DBP Remarked out Me...
‘ 4-15-13 DBP added a year to date button...
Often times there is a date like the following below. But the date is not always in a complete date format. Some have the time added, some don’t. They will always usually have month, day, year like so:
I need to be able to parse the date out if id exists but also eliminate the initials
The time would be nice to have but not necessary.
this code only gets a date if it matches this: 1-9-13 2:30pm DBP
Is there a way to get the date out of this consistently?
a few samples:
‘ 1-4-13 DBP
' 12-13-12 8:27am DBP
' 12-12-12 2:04pm DBP Remarked out Me...
‘ 4-15-13 DBP added a year to date button...
Code:
If InStr(1, line, "'") Then
If InStr(1, line, "------------------------------------") = 0 Then
Comment = Trim(Replace(line, "'", " "))
If Val(Comment) > 0 Then
testDate = Microsoft.VisualBasic.Left(Comment, 15)
For a = 1 To Len(testDate)
GoodDate = GoodDate & Mid(testDate, a, 1)
If IsDate(GoodDate) Then
DateOfComment = CDate(GoodDate)
Exit For
End If
Next
Else
DateOfComment = CDate(#12:00:00 AM#)
End If
DougP