Mar 28, 2011
I'm building an application in which a certain CSV schedule is read and searched for time and date values.
View 7 Replies
I want to read each cell in the CSV file with a streamreader and have VB determine if the contents of the cell represent a date (like 31-10-2011), a time (like 22:30) or random text data which is not formatted like a date or time.
How can I make VB recognize a string as either a date, a time or neither one, so I can use this string formatted as Date, Time or discard of it?
The contents of the CSV file will look something like this:
Although the CSV file will never contain much data, the position of the date and time fields in a row may vary, so I cannot tell VB which cell to read as date/time. It has to recognize the value as date, time, or unusable text.
Dim CSVReadline As New System.IO.StreamReader(schedule.csv")
Cellcheck = CSVReadline.ReadLine()
String = Cellcheck.Split(";")
For i = 0 to 10
Scheduledate = String(i) ............ etc.