whitezombie
Member
- Joined
- Jul 20, 2009
- Messages
- 7
- Programming Experience
- 10+
Hey folks,
I'm new to these forums but am really enjoying reading the various posts. I have a question regarding string to date converting.
I have the following string from a file I need to convert to a valid DATE in VB, but I am unable to with the attempt's I have tried.
The date is: "Thu Dec 13 10:00:06 2007"
So I am assuming it is something like this in VB: "ddd MMM dd hh:mm:ss yyyy"
The code I am using is the following to test against an array to see if the date is encountered, once it is I want it to convert it to a VB based Date.
The arrPADate is an array with the value of a split string that looks like the following:
"MSVS01,Thu Dec 13 10:00:06 2007,NIC1,Intel(R) PRO/1000 MT Server Adapter,Intel(R)"
This grabDATE sub is called from within a FOR loop as it's testing each line of the file for a DATE. So the value being passed to it (strRawVal) is a string like the example above.
Thanks in advance for any assistance,
Jeremy
I'm new to these forums but am really enjoying reading the various posts. I have a question regarding string to date converting.
I have the following string from a file I need to convert to a valid DATE in VB, but I am unable to with the attempt's I have tried.
The date is: "Thu Dec 13 10:00:06 2007"
So I am assuming it is something like this in VB: "ddd MMM dd hh:mm:ss yyyy"
The code I am using is the following to test against an array to see if the date is encountered, once it is I want it to convert it to a VB based Date.
The arrPADate is an array with the value of a split string that looks like the following:
"MSVS01,Thu Dec 13 10:00:06 2007,NIC1,Intel(R) PRO/1000 MT Server Adapter,Intel(R)"
This grabDATE sub is called from within a FOR loop as it's testing each line of the file for a DATE. So the value being passed to it (strRawVal) is a string like the example above.
VB.NET:
Private Sub grabDATE_PA(ByVal strRawVal_PA As String)
Dim arrPADate() = strRawVal_PA.Split(",")
Dim strExtractDATE As String = ""
For intDummy As Integer = 0 To arrPADate.Length
If FormatDateTime(arrPADate(intDummy), "ddd MMM dd hh:mm:ss yyyy") Then
Console.WriteLine("Found Date/Time field in column: " & intDummy & " of value: " & arrPADate(intDummy))
End If
Next
End Sub
Thanks in advance for any assistance,
Jeremy