COleDateTime dateTime(2021, 11, 25, 10, 30, 0); SYSTEMTIME sysTime; dateTime.GetAsSystemTime(sysTime); // sysTime now holds the date and time value in the SYSTEMTIME format
COleDateTime dateTime = COleDateTime::GetCurrentTime(); SYSTEMTIME sysTime; dateTime.GetAsSystemTime(sysTime); // sysTime now holds the current date and time value in the SYSTEMTIME formatIn this example, we use the `GetCurrentTime` method to get the current date and time as a `COleDateTime` object. We then call `GetAsSystemTime` to convert the `COleDateTime` value to a `SYSTEMTIME` structure. `COleDateTime` and `GetAsSystemTime` are part of the MFC library.