I am making an application which requires entering time into the system. I made the time field in the database as nvarchar(5). When I input data into this field using the form in the application it is entered as a string is there a way in which I can convert it into a string into time format?
+2
A:
You could use the DateTime.Parse(String) method. That will return you a DateTime struct.
There are plenty of Date and Time manipulation methods on this struct that you can use. See the link to MSDN for plenty of examples on how to format the date in a variety of ways.
http://msdn.microsoft.com/en-us/library/system.datetime.aspx
Ben Cawley
2010-07-01 09:09:03
+2
A:
You can use DateTime.Parse to convert the string into a DateTime type if the string is in a "known" format.
Or you can use DateTime.ParseExact(dateString, "ddd, dd MMM yy HH:mm:ss 'GMT'", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal)
to specify your own input format.
JWL_
2010-07-01 09:10:31