共用方式為


COleDateTime::operator =

Copies a COleDateTime value.

COleDateTime& operator =(
   const VARIANT& varSrc 
) throw( );
COleDateTime& operator =(
   DATE dtSrc 
) throw( );
COleDateTime& operator =(
   const time_t& timeSrc 
) throw( );
COleDateTime& operator =(
   const __time64_t& timeSrc 
) throw( );
COleDateTime& operator =(
   const SYSTEMTIME& systimeSrc 
) throw( );
COleDateTime& operator =(
   const FILETIME& filetimeSrc 
) throw( );
COleDateTime& operator =(
   const UDATE& udate 
) throw( );

Remarks

These overloaded assignment operators copy the source date/time value into this COleDateTime object. A brief description of each these overloaded assignment operators follows:

  • operator =( dateSrc )   The value and status of the operand are copied into this COleDateTime object.

  • operator =( varSrc )   If the conversion of the VARIANT value (or COleVariant object) to a date/time (VT_DATE) is successful, the converted value is copied into this COleDateTime object and its status is set to valid. If the conversion is not successful, the value of this object is set to zero (30 December 1899, midnight) and its status to invalid.

  • operator =( dtSrc )   The DATE value is copied into this COleDateTime object and its status is set to valid.

  • operator =( timeSrc )   The time_t or __time64_t value is converted and copied into this COleDateTime object. If the conversion is successful, the status of this object is set to valid; if unsuccessful, it is set to invalid.

  • operator =( systimeSrc )   The SYSTEMTIME value is converted and copied into this COleDateTime object. If the conversion is successful, the status of this object is set to valid; if unsuccessful, it is set to invalid.

  • operator =( udate )   The UDATE value is converted and copied into this COleDateTime object. If the conversion is successful, the status of this object is set to valid; if unsuccessful, it is set to invalid. A UDATE structure represents an "unpacked" date. See the function VarDateFromUdate for more details.

  • operator =( filetimeSrc )   The FILETIME value is converted and copied into this COleDateTime object. If the conversion is successful, the status of this object is set to valid; if unsuccessful, it is set to invalid. FILETIME uses Universal Coordinated Time (UTC), so if you pass a local time in the structure, your results will be converted from local file time to system time to variant time. Note that this behavior is the same as in Visual C++ 6.0 and Visual C++.NET 2003 SP2. See File Times in the Windows SDK for more information.

For more information, see the VARIANT entry in the Windows SDK.

For more information on the time_t data type, see the time function in the Run-Time Library Reference.

For more information, see the SYSTEMTIME and FILETIME structures in the Windows SDK.

For more information about the bounds for COleDateTime values, see the article Date and Time: Automation Support.

Requirements

Header: atlcomtime.h

See Also

Concepts

COleDateTime Class

COleDateTime Members

Hierarchy Chart

COleDateTime::COleDateTime

COleDateTime::SetDateTime

COleDateTime::GetStatus