conversion from string to time

Dirty Howi

New member
Joined
Mar 10, 2005
Messages
3
Location
in a house
Programming Experience
10+
i have to convert the value in a text box from a 24hr time format input into a time so that i can pump that value into a sql table.

it does the date no problem, but when it does the time it throws a string not recognized as a valid datetime at system.datetime.parse(string s, datetimeformatinfo......)

any way to convert this thing from say 1700 (as a string in a text box) to a time directly or do i need to convert it first to a int32.


tia
 
DateTime.Parse() only accepts dates and times formatted in certain ways. I've never used it myself, but I believe DateTime.ParseExact() lets you specify whatever format you like, but the string you pass it must match the format exactly.
 
Back
Top