2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by NH1
0

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
0

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();
        }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.