Reputation: 313
I am familiar with creating DateTime object based on current system time
DateTime dtObject = DateTime::Now;
My question is: if I have integer variables iHour, iMinute and iSecond, how do I "put them back" into a DateTime object?
I hope I made myself clear. Thanks in advance!
Upvotes: 0
Views: 1135
Reputation: 52471
Something along the lines of
DateTime today = DateTime::Today;
DateTime todayWithTime(today.Year, today.Month, today.Day,
hour, minute, second);
Another approach:
DateTime todayWithTime = DateTime::Today + TimeSpan(hour, minute, second);
Upvotes: 1