Convert String to Time

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I get a string from TextBox.Text as Time,
user insert an houre = "10:25" , How to use this.
is the following is currect :

DateTime A = textBox.Text.ToString("MM:SS"); ????
 
Glen and Joe,

The static Parse method on the TimeSpan structure might be more
appropriate, since there is no date component to the value. The span can be
considered the time from midnight (of whatever particular day that is being
worked with) to the time entered. Using a TimeSpan also makes the
formatting easier than using a DateTime class.

Hope this helps.
 
Back
Top