How to get the time from a computer
-
Hi all, I'd like to know how would i be able to code an application to copy the time (copy a time stamp) from a client computers clock. Example Program: A simple windows application with a button on it, when i click the button, the client computer returns a time stamp or time strap from the computer's clock to the form "04:17pm", to a label or textbox. The source code would be very much appreciated ..! Thanx!
-
Hi all, I'd like to know how would i be able to code an application to copy the time (copy a time stamp) from a client computers clock. Example Program: A simple windows application with a button on it, when i click the button, the client computer returns a time stamp or time strap from the computer's clock to the form "04:17pm", to a label or textbox. The source code would be very much appreciated ..! Thanx!
Logically, you should look at the
DateTime
structure in the .NET Framework SDK, which has a static property calledNow
. If you further look at the documentation forToString
, the solution's quite obvious:textBox1.Text = DateTime.Now.ToString("hh:mmtt");
Microsoft MVP, Visual C# My Articles