I need help with converting standard time to military time through a button.
Then being able to use another button to convert back.

Where are you getting the time you want to convert? Where do you want the result to end up?

If you have it in a DateTime object, then:

myDTobject.ToString("hh:mm"); // 'standard' time
myDTobject.ToString("HH:mm"); // 'military' (or 24 hour) time

Where are you getting the time you want to convert? Where do you want the result to end up?

If you have it in a DateTime object, then:

myDTobject.ToString("hh:mm"); // 'standard' time
myDTobject.ToString("HH:mm"); // 'military' (or 24 hour) time

This is what i have for Code as far as time and date.

private void Form1_Load(object sender, EventArgs e)
        {
            //Current Date
            label1.Text = DateTime.Now.ToShortDateString();

            timer1.Enabled = true;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            //Current Time
            label3.Text = DateTime.Now.ToLongTimeString();
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.