Windows Develop Bookmark and Share   
 index > Windows Forms General > Windows Time in a TextBox control
 

Windows Time in a TextBox control

How would I go about retreiving the Windows Time and displaying it in a textBox? (And can it be displayed in military time? Standard time?)
Ðãvę Âņđęŕŝőŋ1  Thursday, July 27, 2006 7:53 PM

Hi,

you can retrieve system time using DateTime class:

textBox1.Text = DateTime.Now.ToString(format);

Look here for date/time formatting options.

Andrej

Andrej Tozon  Thursday, July 27, 2006 8:09 PM

Hi,

you can retrieve system time using DateTime class:

textBox1.Text = DateTime.Now.ToString(format);

Look here for date/time formatting options.

Andrej

Andrej Tozon  Thursday, July 27, 2006 8:09 PM
Common: Now.ToString("h:mm:ss tt")
Military: Now.ToString("HH:mm:ss")
With apologies to the rest of the world...

nobugz  Thursday, July 27, 2006 10:08 PM

You can use google to search for other answers

Custom Search

More Threads

• C# Disposing panels
• Convert string to DateTime
• Format Value on LostFocus
• Drag_enter executes twice
• Child Form
• Show fullscreen mpeg on form2 and small preview on form1
• Accessviolation exception when printing
• RightClick Event on a control with a ContextMenuStrip binded to the form ???
• Key-Based List Control?
• Verify Dataset Read