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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top