Clock Time !

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • newkhan
    New Member
    • Oct 2007
    • 35

    Clock Time !

    Hello,
    In my recent project I have to make a form in which clock time should be shown. Means my form will be active upto 40 minutes and the time should be shown on form. When user will start work with form then current time will be shown on the form and with the system clock tick the timer will decrement. At 40 minutes application will be exit. Now tell me how to read system clock time at every moment. How it will be made on thread as both form and clock should be run at the same time. The code should be in C#.NET

    Thank You.
    Last edited by newkhan; Feb 23 '08, 04:40 AM. Reason: Language name missed
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    #2
    If you have the timer control in, then in the timer tick event read the system time by
    DateTime.Now

    Comment

    • newkhan
      New Member
      • Oct 2007
      • 35

      #3
      Originally posted by Shashi Sadasivan
      If you have the timer control in, then in the timer tick event read the system time by
      DateTime.Now
      DateTime.Now will return date and time both but i have to read only time and in loop it will not work fine. How I can use it in thread ???

      Comment

      • Shashi Sadasivan
        Recognized Expert Top Contributor
        • Aug 2007
        • 1435

        #4
        DateTime.Now returns the date and the time. If you only want to display the time to the user, you can do so by only diplaying the time component.

        if you try to compare 2 DateTime values then it will also compare the date part, which you should take care of in case you are creating a new instance and sending your values to it.

        Comment

        Working...