The ITDateTime interface

The ITDateTime interface can be exposed by value objects that represent a time-based value.

The following example shows how an application uses a pointer to an ITDateTime interface to extract time-based information and print it.
ITDateTime *dt;

// Extract an interface. The return code IT_QUERYINTERFACE_SUCCESS
// should be used for compatibility reasons.
if (v->QueryInterface(ITDateTimeIID, (void **) &dt)
    == IT_QUERYINTERFACE_SUCCESS)
{
    cout << "The date value is: " << endl
         << "Year:" << dt->Year() << endl
         << "Month: " << dt->Month() << endl
         << "Day: " << dt->Day() << endl
         << "Hour: " << dt->Hour() << endl
         << "Minute: " << dt->Minute() << endl
         << "Second: " << dt->Second() << endl;

    // Release the Date/Time interface
    dt->Release();
}

The application can use the ITDateTime::FromDate and ITDateTime::FromTime methods to set the date and time portions of a datetime object. If an object contains both date and time information and, for example, FromDate is called, the value of the time portion of an object does not change.