Solved

How do I add minutes to a specific time in c#.net?

Posted on 2008-10-15
2
1,176 Views
Last Modified: 2013-12-17
I have a text box  that will populate with the current time when you click inside the text box example(6:40pm). I have another text box that users will enter just a number to represent minutes example (30). I have another text box that I want to display the time after adding the minutes entered to the current time.

EXAMPLE 6:40pm + 30 = 7:10pm
0
Comment
Question by:wademi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Expert Comment

by:CuteBug
ID: 22727146
Convert the value in the first textbox to DateTime object.
And then call the AddMinutes() method of that object with the data in the second textbox as argument.
0
 
LVL 6

Accepted Solution

by:
carlsiy earned 500 total points
ID: 22727158
Provided that you have 3 TextBoxes.
textBox1 = Current Time
textBox2 = Amount of minutes to be added
textBox3 = Output of textBox1 + textBox2

        private void button4_Click(object sender, EventArgs e)
        {
            textBox3.Text = DateTime.Parse(textBox1.Text).AddMinutes(double.Parse(textBox2.Text)).ToShortTimeString();
        }
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question