digitaldrew
Well-known member
- Joined
- Nov 10, 2012
- Messages
- 167
- Programming Experience
- Beginner
I'm using VB express 2010 and have been working on reading a text file into an MSSQL database. Once I read the file into the database I convert a date/time string into a new date/time format and add 15 minutes to that time. Keep in mind, every line coming into the database is currently in EST. I'm trying to take the file in and convert it to CST and then add 15 minutes.
This seams to work fine for me here in the US, but I've found that people in some other countries (GTB Standard Time, for example) will get an exception error:
Here is some of my code...
From reading the complete exception error it appears the main issue is around line 2.
Any help would be appriciated!
This seams to work fine for me here in the US, but I've found that people in some other countries (GTB Standard Time, for example) will get an exception error:
String was not recognized as a valid DateTime.
Here is some of my code...
VB.NET:
'convert date time string to date time format and add 15 minutes
ConvertedTime = Convert.ToDateTime(strArray(2))
newConvertedTime = ConvertedTime.AddMinutes(addtime)
strArray(2) = newConvertedTime
'subtract one hour to make Central time
newConvertedTime = newConvertedTime.AddHours(-1)
Format(newConvertedTime, "hh:mm AM/PM")
'Format(newConvertedTime.ToShortTimeString)
strArray(2) = newConvertedTime
strArray(0) = strArray(0).PadRight(78, " ")
strArray(2) = strArray(2).PadRight(12, " ")
'Add the following two lines of code so seconds don't appear in Gridview
strArray(2) = strArray(2).Replace(":00 AM", " AM")
strArray(2) = strArray(2).Replace(":00 PM", " PM")
DomainData(cnt) = strArray(0) & strArray(2)
From reading the complete exception error it appears the main issue is around line 2.
Any help would be appriciated!