0

我尝试使用 DateTime::Now 来显示系统日期时间。

在此处输入图像描述

我希望将它们分成<date hour mins secs>,以便我可以使用小时和分钟来执行一些计算。

可以做到吗?

4

1 回答 1

0

The DateTime structure returned by DateTime::Now is documented on MSDN here.

There are plenty of properties that allow you to access the components of the date. For example

DateTime pNow = DateTime::Now;
int nDay = pNow.Day;
int nYear = pNow.Year;
int nHour = pNow.Hour;
int nMinute = pNow.Minute;

// etc. etc.
于 2013-05-29T04:54:43.540 回答