COleDateTime::SetTime

Sets the time of this COleDateTime object.

int SetTime( 
   int nHour, 
   int nMin, 
   int nSec  
) throw( );

Parameters

  • nHour, nMin, nSec
    Indicate the time components to be copied into this COleDateTime object.

Return Value

Zero if the value of this COleDateTime object was set successfully; otherwise, 1. This return value is based on the DateTimeStatus enumerated type. For more information, see the SetStatus member function.

Remarks

The time is set to the specified values. The date is set to date 0, meaning 30 December 1899.

See the following table for bounds for the parameter values:

Parameter

Bounds

nHour

0 – 23

nMin

0 – 59

nSec

0 – 59

If the time value specified by the parameters is not valid, the status of this object is set to invalid and the value of this object is not changed.

Here are some examples of time values:

nHour

nMin

nSec

Value

1

3

3

01:03:03

23

45

0

23:45:00

25

30

0

Invalid

9

60

0

Invalid

To set both date and time, see COleDateTime::SetDateTime.

For information on member functions that query the value of this COleDateTime object, see the following member functions:

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

Example

See the example for SetDate.

Requirements

Header: atlcomtime.h

See Also

Reference

COleDateTime Class

Hierarchy Chart

COleDateTime::COleDateTime

COleDateTime::SetDateTime

COleDateTime::operator =

COleDateTime::GetStatus

COleDateTime::m_dt