共用方式為


COleDateTimeSpan::SetStatus

Sets the status (validity) of this COleDateTimeSpan object.

void SetStatus( 
   DateTimeSpanStatus status  
) throw( );

Parameters

  • status
    The new status value for this COleDateTimeSpan object.

Remarks

The Status parameter value is defined by the DateTimeSpanStatus enumerated type, which is defined within the COleDateTimeSpan class.

enum DateTimeSpanStatus{

valid = 0,

invalid = 1,

null = 2,

};

For a brief description of these status values, see the following list:

  • COleDateTimeSpan::valid   Indicates that this COleDateTimeSpan object is valid.

  • COleDateTimeSpan::invalid   Indicates that this COleDateTimeSpan object is invalid; that is, its value may be incorrect.

  • COleDateTimeSpan::null   Indicates that this COleDateTimeSpan object is null, that is, that no value has been supplied for this object. (This is "null" in the database sense of "having no value," as opposed to the C++ NULL.)

    Warning

    This function is for advanced programming situations. This function does not alter the data in this object. It will most often be used to set the status to null or invalid. Note that the assignment operator (operator =) and SetDateTimeSpan do set the status of the object based on the source value(s).

Example

// if the person is not still in school, set days to graduation to null 
if (!m_bStillInSchool || m_dtDateOfGraduation.GetStatus() == COleDateTime::null)
   m_dtsDaysToGraduation.SetStatus(COleDateTimeSpan::null);   

Requirements

Header: atlcomtime.h

See Also

Reference

COleDateTimeSpan Class

Hierarchy Chart

COleDateTimeSpan::GetStatus

COleDateTimeSpan::m_status