Q:

Get system date and time as string when a button is clicked - VC++ Windows Forms

I am working on a windows forms application and using c++, not c#. I have a button in my form. This button, when clicked, must get system date and time and assign the values to strings Year, Month, Day, Hour, Minute seperately. How can I achieve this? What should I write in the button's click event handler?
Note: I am totally newbie.

A:

Maybe you mean:
String^ Year = System::DateTime::Now.Year.ToString();
String^ Month = System::DateTime::Now.Month.ToString();
String^ Day = System::DateTime::Now.Day.ToString();
String^ Hour = System::DateTime::Now.Hour.ToString();
String^ Minute = System::DateTime::Now.Minute.ToString();

The Hour value is represented in the 24-hour system.

