Dela via


CTime::GetHour

Returns the hour represented by the CTime object.

int GetHour( ) const throw( );

Return Value

Returns the hour, based on local time, in the range 0 through 23.

Remarks

This function calls GetLocalTm, which uses an internal statically allocated buffer. The data in this buffer is overwritten because of calls to other CTime member functions.

Example

// Example for CTime::GetHour, CTime::GetMinute, and CTime::GetSecond
CTime t(1999, 3, 19, 22, 15, 0); // 10:15 PM March 19, 1999
ATLASSERT(t.GetSecond() == 0);
ATLASSERT(t.GetMinute() == 15);
ATLASSERT(t.GetHour() == 22);   

Requirements

Header: atltime.h

See Also

Reference

CTime Class

Hierarchy Chart

Other Resources

CTime Members