# MTCalendarDay

Base class for CalendarWeekday and CalendarHoliday

(This object is used by the MTCalendar object.)

## Program ID

Metratech.MTCalendarDay.1

## Methods

CreatePeriod | Adds a new period to the calendar.
GetPeriods | Returns the MTCalendarPeriod collection of this MTCalendarDay (sort order is by start time).
GetCodeAsString | Returns the calendar code as a string. (The calendar code is a MetraNet enumerated type.)
RemovePeriod | Removes a specified period for a calendar by its StatTime property.
ValidatePeriodTimes | Validate a start and an end time against the current collection of CalendarPeriods.

## Properties

Properties | Returns all (core and extended) properties of this object as a collection of MTProperty objects.
ID | The unique (database) ID for the calendar.
Code | The default calendar code for this day.

# Method Detail

## CreatePeriod

Adds a new period to the calendar.

### Visual Basic Syntax

CreatePeriod() As IMTCalendarPeriod

### C++ Syntax

HRESULT CreatePeriod([out, retval] IMTCalendarPeriod* *apCalPeriod);

## GetPeriods

Returns the MTCalendarPeriod collection of this MTCalendarDay (sort order is by start time).

### Visual Basic Syntax

GetPeriods() As IMTCollection

### C++ Syntax

HRESULT GetPeriods([out, retval] IMTCollection* *pVal);

## GetCodeAsString

Returns the calendar code as a string. (The calendar code is a MetraNet enumerated type.)

### Visual Basic Syntax

GetCodeAsString() As String

### C++ Syntax

HRESULT GetCodeAsString([out, retval] BSTR* pVal);

## RemovePeriod

Removes a specified period for a calendar by its StatTime property.

### Visual Basic Syntax

RemovePeriod(Val As Long)

### C++ Syntax

HRESULT RemovePeriod([in] long newVal);

##

## Save

This method saves modifications to the database.

### Visual Basic Syntax

Save()

### C++ Syntax

HRESULT Save();

## ValidatePeriodTimes

This method will validate a start and an end time against the current collection of CalendarPeriods, checking for overlaps.

### Visual Basic Syntax

Function ValidatePeriodTimes(startVal As Long, endVal As Long) As Boolean

### C++ Syntax

HRESULT ValidatePeriodTimes([in] long startVal, [in] long endVal, [out, retval] VARIANT_BOOL* pVal);

# Property Detail

##

## Properties

Returns all (core and extended) properties of this object as a collection of MTProperty objects.

### Visual Basic Syntax

Properties() As IMTProperties

### C++ Syntax

HRESULT Properties([out, retval] IMTProperties * *pVal);

## Code

The default calendar code for this day.

### Visual Basic Syntax

Property Code As Long

### C++ Syntax

HRESULT Code([out, retval] long *pVal);

HRESULT Code([in] long newVal);

## ID

This property specifies the unique (database) ID for the calendar.

### Visual Basic Syntax

Property ID As Long

### C++ Syntax

HRESULT ID([out, retval] long *pVal);

HRESULT ID([in] long newVal);