jpshaver

jpshaver

  • NA
  • 8
  • 0

Date Time Conversion

Sep 23 2004 7:16 PM
As a newbie I know the very least about anything, thus the reason for this simple question: I need to convert a string field into a datetime format in order to store it in a SQL Server database table field which is a simple SQL datetime field. In looking at the conversion information in MSDN, I can only find some extremely arcane code. I have a feeling that I could just create a string of a proper format and pass it to the Convert.ToDateTime method and get the desired result. (One of the overloads provides for a string argument.) A little more about what I am doing: I have a combo box into which I've placed strings that indicate time of day: 12:00:00 AM, 01:00:00 AM, 02:00:00 AM and so on. The idea is for the user to select the desired time from the pull down. Then I'll store it in the database (by way of a datatable) in a datetime format once I convert it. If there is a better way to go about this, I'd enjoy hearing about it. Thanks for any assistance you can provide... Jerry

Answers (1)