0

Hi,
I am able to create a clock in a console c++ app...like this one show UTC hours:

#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include <stdio.h>

void main()
{
    SYSTEMTIME st, lt;
    
    GetSystemTime(&st);
    GetLocalTime(&lt);
    
	std::cout << st.wHour << std::endl;
	std::cin.get();
}

But I am not able to create this with the .NET Framework 3.5, I mean Windows Forms.
I want to assign HOURS : MINUTES : SECONDS to a label.
Can you help me out?


Regards

Edited by electrox73: Forgot some extra info

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

Look into a DateTime object: http://msdn.microsoft.com/en-us/library/system.datetime_members(v=VS.90).aspx

Create an instance of a DateTime object and set it equal to DateTime::Now, then just use the hours, minutes, seconds members to get what you need.

If you want it to update every second, use a Timer object.

Sorry, but that's kinda too complicated to me, isn't there an easier way?


Regards

0

That's actually probably the least complicated way. What problems are you having in implementing it?

Edited by jonsca: n/a

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.